From b2f0f481eee4f9be48e1212bd27a8671c2e9ceca Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Thu, 18 Nov 2021 11:23:15 +0100 Subject: 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. --- test.py | 10 ++++++++-- 1 file 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 -- cgit v1.2.3