aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2021-11-18 11:23:15 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2021-11-18 11:23:15 +0100
commitb2f0f481eee4f9be48e1212bd27a8671c2e9ceca (patch)
tree35e8279cfa0a52bf6d0867dfb050e9fb9ddc0b82
parent2e93efd61228eece2a9d9811fff0f658bd512c11 (diff)
downloadgeldschieberbot-b2f0f481eee4f9be48e1212bd27a8671c2e9ceca.tar.gz
geldschieberbot-b2f0f481eee4f9be48e1212bd27a8671c2e9ceca.zip
test.py: don't use subprocess.run(check=True)
Using check=True will cause subprocess.run to raise an exception and our own failure handling code like printing what happend will not run.
-rwxr-xr-xtest.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/test.py b/test.py
index bfb27e3..b0a892f 100755
--- a/test.py
+++ b/test.py
@@ -53,20 +53,26 @@ scheduled_state_template = Template("""
"changes": {"alice": [], "bob": [], "charlie": []}}""")
-def run_bot(test, sender, cmd):
+def _run_bot(sender, cmd):
msg = msg_template.substitute(sender=sender, msg=cmd).replace("\n",
"\\n") + "\n"
res = subprocess.run(
["python3", "./geldschieberbot.py"],
text=True,
capture_output=True,
- check=True,
+ check=False,
# res = subprocess.run(["python3", "./bot.py"], text=True, capture_output=True,
input=msg)
if res.returncode != 0:
print(res.stdout)
print(res.stderr)
+
+ return res
+
+
+def run_bot(test, sender, cmd):
+ res = _run_bot(sender, cmd)
test.assertEqual(res.returncode, 0)
test.assertEqual(res.stderr, "")
return res