aboutsummaryrefslogtreecommitdiff
path: root/src/peerinfo-tool/test_gnunet_peerinfo.py.in
diff options
context:
space:
mode:
authorNils Gillmann <ng0@n0.is>2018-05-22 08:56:50 +0000
committerNils Gillmann <ng0@n0.is>2018-05-22 08:56:50 +0000
commit3c9d70c60631aeb26e4adab6d37aeb953dcd6dfa (patch)
tree58f3fc91a3ea3dcfbd6c052c6da3a033f1cd537a /src/peerinfo-tool/test_gnunet_peerinfo.py.in
parent882a4ce1bb696d00abaa841ac88737765588cee9 (diff)
downloadgnunet-3c9d70c60631aeb26e4adab6d37aeb953dcd6dfa.tar.gz
gnunet-3c9d70c60631aeb26e4adab6d37aeb953dcd6dfa.zip
peerinfo-tool: flake8 adjustments
Signed-off-by: Nils Gillmann <ng0@n0.is>
Diffstat (limited to 'src/peerinfo-tool/test_gnunet_peerinfo.py.in')
-rwxr-xr-xsrc/peerinfo-tool/test_gnunet_peerinfo.py.in88
1 files changed, 44 insertions, 44 deletions
diff --git a/src/peerinfo-tool/test_gnunet_peerinfo.py.in b/src/peerinfo-tool/test_gnunet_peerinfo.py.in
index 657096962..fb5941121 100755
--- a/src/peerinfo-tool/test_gnunet_peerinfo.py.in
+++ b/src/peerinfo-tool/test_gnunet_peerinfo.py.in
@@ -26,70 +26,70 @@ import shutil
26import time 26import time
27 27
28srcdir = "../.." 28srcdir = "../.."
29gnunet_pyexpect_dir = os.path.join (srcdir, "contrib/scripts") 29gnunet_pyexpect_dir = os.path.join(srcdir, "contrib/scripts")
30if gnunet_pyexpect_dir not in sys.path: 30if gnunet_pyexpect_dir not in sys.path:
31 sys.path.append (gnunet_pyexpect_dir) 31 sys.path.append(gnunet_pyexpect_dir)
32 32
33from gnunet_pyexpect import pexpect 33from gnunet_pyexpect import pexpect
34 34
35if os.name == 'posix': 35if os.name == 'posix':
36 peerinfo = './gnunet-peerinfo' 36 peerinfo = './gnunet-peerinfo'
37 gnunetarm = 'gnunet-arm' 37 gnunetarm = 'gnunet-arm'
38 gnunettesting = 'gnunet-testing' 38 gnunettesting = 'gnunet-testing'
39elif os.name == 'nt': 39elif os.name == 'nt':
40 peerinfo = './gnunet-peerinfo.exe' 40 peerinfo = './gnunet-peerinfo.exe'
41 gnunetarm = 'gnunet-arm.exe' 41 gnunetarm = 'gnunet-arm.exe'
42 gnunettesting = 'gnunet-testing.exe' 42 gnunettesting = 'gnunet-testing.exe'
43 43
44pinfo = pexpect () 44pinfo = pexpect()
45 45
46 46
47if os.name == "nt": 47if os.name == "nt":
48 shutil.rmtree (os.path.join (os.getenv ("TEMP"), "gnunet-test-peerinfo"), True) 48 shutil.rmtree(os.path.join(os.getenv("TEMP"), "gnunet-test-peerinfo"), True)
49else: 49else:
50 shutil.rmtree ("/tmp/gnunet-test-peerinfo", True) 50 shutil.rmtree("/tmp/gnunet-test-peerinfo", True)
51 51
52# create hostkey via testing lib 52# create hostkey via testing lib # FIXME: The /tmp/ location needs to be adjusted to the TMP variable!
53hkk = subprocess.Popen ([gnunettesting, '-n', '1', '-c', 'test_gnunet_peerinfo_data.conf', '-k', '/tmp/gnunet-test-peerinfo/.hostkey']) 53hkk = subprocess.Popen([gnunettesting, '-n', '1', '-c', 'test_gnunet_peerinfo_data.conf', '-k', '/tmp/gnunet-test-peerinfo/.hostkey'])
54hkk.communicate () 54hkk.communicate()
55 55
56arm = subprocess.Popen ([gnunetarm, '-sq', '-c', 'test_gnunet_peerinfo_data.conf']) 56arm = subprocess.Popen([gnunetarm, '-sq', '-c', 'test_gnunet_peerinfo_data.conf'])
57arm.communicate () 57arm.communicate()
58 58
59try: 59try:
60 pinfo.spawn (None, [peerinfo, '-c', 'test_gnunet_peerinfo_data.conf', '-s'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 60 pinfo.spawn(None, [peerinfo, '-c', 'test_gnunet_peerinfo_data.conf', '-s'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
61 pinfo.expect ("stdout", re.compile (r'I am peer `.*\'.\r?\n')) 61 pinfo.expect("stdout", re.compile(r'I am peer `.*\'.\r?\n'))
62 62
63 pinfo.spawn (None, [peerinfo, '-c', 'test_gnunet_peerinfo_data.conf', '-qs'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 63 pinfo.spawn(None, [peerinfo, '-c', 'test_gnunet_peerinfo_data.conf', '-qs'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
64 pinfo.expect ("stdout", re.compile (r'....................................................\r?\n')) 64 pinfo.expect("stdout", re.compile(r'....................................................\r?\n'))
65 65
66 pinfo.spawn (None, [peerinfo, '-c', 'test_gnunet_peerinfo_data.conf', 'invalid'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 66 pinfo.spawn(None, [peerinfo, '-c', 'test_gnunet_peerinfo_data.conf', 'invalid'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
67 pinfo.expect ("stdout", re.compile (r'Invalid command line argument `invalid\'\r?\n')) 67 pinfo.expect("stdout", re.compile(r'Invalid command line argument `invalid\'\r?\n'))
68 68
69 arm = subprocess.Popen ([gnunetarm, '-q', '-i', 'transport', '-c', 'test_gnunet_peerinfo_data.conf']) 69 arm = subprocess.Popen([gnunetarm, '-q', '-i', 'transport', '-c', 'test_gnunet_peerinfo_data.conf'])
70 arm.communicate () 70 arm.communicate()
71 time.sleep (1) 71 time.sleep(1)
72 72
73 pinfo.spawn (None, [peerinfo, '-i', '-c', 'test_gnunet_peerinfo_data.conf'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 73 pinfo.spawn(None, [peerinfo, '-i', '-c', 'test_gnunet_peerinfo_data.conf'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
74 pinfo.expect ("stdout", re.compile ("Peer `.*'\r?\n")) 74 pinfo.expect("stdout", re.compile("Peer `.*'\r?\n"))
75 m = pinfo.expect ("stdout", re.compile ("\s.*:24357\r?\n")) 75 m = pinfo.expect("stdout", re.compile("\s.*:24357\r?\n"))
76 while len (m.group (0)) > 0: 76 while len(m.group(0)) > 0:
77 m = pinfo.expect ("stdout", re.compile ("(\s.*:24357\r?\n|\r?\n|)")) 77 m = pinfo.expect("stdout", re.compile("(\s.*:24357\r?\n|\r?\n|)"))
78 78
79 pinfo.spawn (None, [peerinfo, '-i', '-c', 'test_gnunet_peerinfo_data.conf', '-n'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 79 pinfo.spawn(None, [peerinfo, '-i', '-c', 'test_gnunet_peerinfo_data.conf', '-n'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
80 pinfo.expect ("stdout", re.compile ("Peer `.*'\r?\n")) 80 pinfo.expect("stdout", re.compile("Peer `.*'\r?\n"))
81 m = pinfo.expect ("stdout", re.compile ("\s.*:24357\r?\n")) 81 m = pinfo.expect("stdout", re.compile("\s.*:24357\r?\n"))
82 while len (m.group (0)) > 0: 82 while len(m.group(0)) > 0:
83 m = pinfo.expect ("stdout", re.compile ("(\s.*:24357\r?\n|\r?\n|)")) 83 m = pinfo.expect("stdout", re.compile("(\s.*:24357\r?\n|\r?\n|)"))
84 84
85 pinfo.spawn (None, [peerinfo, '-c', 'test_gnunet_peerinfo_data.conf', '-qs'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 85 pinfo.spawn(None, [peerinfo, '-c', 'test_gnunet_peerinfo_data.conf', '-qs'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
86 pid = pinfo.read ("stdout") 86 pid = pinfo.read("stdout")
87 pid.strip () 87 pid.strip()
88 88
89finally: 89finally:
90 arm = subprocess.Popen ([gnunetarm, '-eq', '-c', 'test_gnunet_peerinfo_data.conf']) 90 arm = subprocess.Popen([gnunetarm, '-eq', '-c', 'test_gnunet_peerinfo_data.conf'])
91 arm.communicate () 91 arm.communicate()
92 if os.name == "nt": 92 if os.name == "nt":
93 shutil.rmtree (os.path.join (os.getenv ("TEMP"), "gnunet-test-peerinfo"), True) 93 shutil.rmtree(os.path.join(os.getenv("TEMP"), "gnunet-test-peerinfo"), True)
94 else: 94 else:
95 shutil.rmtree ("/tmp/gnunet-test-peerinfo", True) 95 shutil.rmtree("/tmp/gnunet-test-peerinfo", True)