diff options
author | Nils Gillmann <ng0@n0.is> | 2018-05-22 08:56:50 +0000 |
---|---|---|
committer | Nils Gillmann <ng0@n0.is> | 2018-05-22 08:56:50 +0000 |
commit | 3c9d70c60631aeb26e4adab6d37aeb953dcd6dfa (patch) | |
tree | 58f3fc91a3ea3dcfbd6c052c6da3a033f1cd537a | |
parent | 882a4ce1bb696d00abaa841ac88737765588cee9 (diff) | |
download | gnunet-3c9d70c60631aeb26e4adab6d37aeb953dcd6dfa.tar.gz gnunet-3c9d70c60631aeb26e4adab6d37aeb953dcd6dfa.zip |
peerinfo-tool: flake8 adjustments
Signed-off-by: Nils Gillmann <ng0@n0.is>
-rwxr-xr-x | src/peerinfo-tool/test_gnunet_peerinfo.py.in | 88 |
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 | |||
26 | import time | 26 | import time |
27 | 27 | ||
28 | srcdir = "../.." | 28 | srcdir = "../.." |
29 | gnunet_pyexpect_dir = os.path.join (srcdir, "contrib/scripts") | 29 | gnunet_pyexpect_dir = os.path.join(srcdir, "contrib/scripts") |
30 | if gnunet_pyexpect_dir not in sys.path: | 30 | if gnunet_pyexpect_dir not in sys.path: |
31 | sys.path.append (gnunet_pyexpect_dir) | 31 | sys.path.append(gnunet_pyexpect_dir) |
32 | 32 | ||
33 | from gnunet_pyexpect import pexpect | 33 | from gnunet_pyexpect import pexpect |
34 | 34 | ||
35 | if os.name == 'posix': | 35 | if 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' |
39 | elif os.name == 'nt': | 39 | elif 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 | ||
44 | pinfo = pexpect () | 44 | pinfo = pexpect() |
45 | 45 | ||
46 | 46 | ||
47 | if os.name == "nt": | 47 | if 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) |
49 | else: | 49 | else: |
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! |
53 | hkk = subprocess.Popen ([gnunettesting, '-n', '1', '-c', 'test_gnunet_peerinfo_data.conf', '-k', '/tmp/gnunet-test-peerinfo/.hostkey']) | 53 | hkk = subprocess.Popen([gnunettesting, '-n', '1', '-c', 'test_gnunet_peerinfo_data.conf', '-k', '/tmp/gnunet-test-peerinfo/.hostkey']) |
54 | hkk.communicate () | 54 | hkk.communicate() |
55 | 55 | ||
56 | arm = subprocess.Popen ([gnunetarm, '-sq', '-c', 'test_gnunet_peerinfo_data.conf']) | 56 | arm = subprocess.Popen([gnunetarm, '-sq', '-c', 'test_gnunet_peerinfo_data.conf']) |
57 | arm.communicate () | 57 | arm.communicate() |
58 | 58 | ||
59 | try: | 59 | try: |
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 | ||
89 | finally: | 89 | finally: |
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) |