diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2021-11-18 11:23:15 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2021-11-18 11:23:15 +0100 |
| commit | b2f0f481eee4f9be48e1212bd27a8671c2e9ceca (patch) | |
| tree | 35e8279cfa0a52bf6d0867dfb050e9fb9ddc0b82 | |
| parent | 2e93efd61228eece2a9d9811fff0f658bd512c11 (diff) | |
| download | geldschieberbot-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-x | test.py | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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 |
