summaryrefslogtreecommitdiff
path: root/src/peerinfo-tool/test_gnunet_peerinfo.py.in
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-10-12 18:16:07 +0000
committerng0 <ng0@n0.is>2019-10-12 18:16:07 +0000
commita5f5e7ed9b07b902af4438d76087e034abcba9b2 (patch)
tree6f376f93f1c785103d0b30f54311a0f61d2bdced /src/peerinfo-tool/test_gnunet_peerinfo.py.in
parent8e827de2a1db34dfe15f5f9da2850ca469b5ecc3 (diff)
format python
Diffstat (limited to 'src/peerinfo-tool/test_gnunet_peerinfo.py.in')
-rwxr-xr-xsrc/peerinfo-tool/test_gnunet_peerinfo.py.in75
1 files changed, 58 insertions, 17 deletions
diff --git a/src/peerinfo-tool/test_gnunet_peerinfo.py.in b/src/peerinfo-tool/test_gnunet_peerinfo.py.in
index d07224b14..5d9daa930 100755
--- a/src/peerinfo-tool/test_gnunet_peerinfo.py.in
+++ b/src/peerinfo-tool/test_gnunet_peerinfo.py.in
@@ -11,7 +11,7 @@
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Affero General Public License for more details.
-#
+#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
@@ -43,53 +43,94 @@ elif os.name == 'nt':
pinfo = pexpect()
-
if os.name == "nt":
shutil.rmtree(os.path.join(os.getenv("TEMP"), "gnunet-test-peerinfo"), True)
else:
shutil.rmtree("/tmp/gnunet-test-peerinfo", True)
# create hostkey via testing lib # FIXME: The /tmp/ location needs to be adjusted to the TMP variable!
-hkk = subprocess.Popen([gnunettesting, '-n', '1', '-c', 'test_gnunet_peerinfo_data.conf', '-k', '/tmp/gnunet-test-peerinfo/.hostkey'])
+hkk = subprocess.Popen([
+ gnunettesting, '-n', '1', '-c', 'test_gnunet_peerinfo_data.conf', '-k',
+ '/tmp/gnunet-test-peerinfo/.hostkey'
+])
hkk.communicate()
-arm = subprocess.Popen([gnunetarm, '-sq', '-c', 'test_gnunet_peerinfo_data.conf'])
+arm = subprocess.Popen([
+ gnunetarm, '-sq', '-c', 'test_gnunet_peerinfo_data.conf'
+])
arm.communicate()
try:
- pinfo.spawn(None, [peerinfo, '-c', 'test_gnunet_peerinfo_data.conf', '-s'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ pinfo.spawn(
+ None, [peerinfo, '-c', 'test_gnunet_peerinfo_data.conf', '-s'],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT
+ )
pinfo.expect("stdout", re.compile(r'I am peer `.*\'.\r?\n'))
- pinfo.spawn(None, [peerinfo, '-c', 'test_gnunet_peerinfo_data.conf', '-qs'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- pinfo.expect("stdout", re.compile(r'....................................................\r?\n'))
-
- pinfo.spawn(None, [peerinfo, '-c', 'test_gnunet_peerinfo_data.conf', 'invalid'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- pinfo.expect("stdout", re.compile(r'Invalid command line argument `invalid\'\r?\n'))
-
- arm = subprocess.Popen([gnunetarm, '-q', '-i', 'transport', '-c', 'test_gnunet_peerinfo_data.conf'])
+ pinfo.spawn(
+ None, [peerinfo, '-c', 'test_gnunet_peerinfo_data.conf', '-qs'],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT
+ )
+ pinfo.expect(
+ "stdout",
+ re.
+ compile(r'....................................................\r?\n')
+ )
+
+ pinfo.spawn(
+ None, [peerinfo, '-c', 'test_gnunet_peerinfo_data.conf', 'invalid'],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT
+ )
+ pinfo.expect(
+ "stdout", re.compile(r'Invalid command line argument `invalid\'\r?\n')
+ )
+
+ arm = subprocess.Popen([
+ gnunetarm, '-q', '-i', 'transport', '-c',
+ 'test_gnunet_peerinfo_data.conf'
+ ])
arm.communicate()
time.sleep(1)
- pinfo.spawn(None, [peerinfo, '-i', '-c', 'test_gnunet_peerinfo_data.conf'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ pinfo.spawn(
+ None, [peerinfo, '-i', '-c', 'test_gnunet_peerinfo_data.conf'],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT
+ )
pinfo.expect("stdout", re.compile("Peer `.*'\r?\n"))
m = pinfo.expect("stdout", re.compile("\s.*:24357\r?\n"))
while len(m.group(0)) > 0:
m = pinfo.expect("stdout", re.compile("(\s.*:24357\r?\n|\r?\n|)"))
- pinfo.spawn(None, [peerinfo, '-i', '-c', 'test_gnunet_peerinfo_data.conf', '-n'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ pinfo.spawn(
+ None, [peerinfo, '-i', '-c', 'test_gnunet_peerinfo_data.conf', '-n'],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT
+ )
pinfo.expect("stdout", re.compile("Peer `.*'\r?\n"))
m = pinfo.expect("stdout", re.compile("\s.*:24357\r?\n"))
while len(m.group(0)) > 0:
m = pinfo.expect("stdout", re.compile("(\s.*:24357\r?\n|\r?\n|)"))
- pinfo.spawn(None, [peerinfo, '-c', 'test_gnunet_peerinfo_data.conf', '-qs'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ pinfo.spawn(
+ None, [peerinfo, '-c', 'test_gnunet_peerinfo_data.conf', '-qs'],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT
+ )
pid = pinfo.read("stdout")
pid.strip()
finally:
- arm = subprocess.Popen([gnunetarm, '-eq', '-c', 'test_gnunet_peerinfo_data.conf'])
+ arm = subprocess.Popen([
+ gnunetarm, '-eq', '-c', 'test_gnunet_peerinfo_data.conf'
+ ])
arm.communicate()
if os.name == "nt":
- shutil.rmtree(os.path.join(os.getenv("TEMP"), "gnunet-test-peerinfo"), True)
+ shutil.rmtree(
+ os.path.join(os.getenv("TEMP"), "gnunet-test-peerinfo"), True
+ )
else:
shutil.rmtree("/tmp/gnunet-test-peerinfo", True)