From 73d8e01452ea589409bff4cec9f4a857f20a2585 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Sun, 10 Dec 2023 18:24:08 +0100 Subject: [PATCH] don't print a traceback but do a proper return code for "cmdeploy test" --- deploy-chatmail/src/deploy_chatmail/cmdeploy.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/deploy-chatmail/src/deploy_chatmail/cmdeploy.py b/deploy-chatmail/src/deploy_chatmail/cmdeploy.py index 5bb96393..c2d46103 100644 --- a/deploy-chatmail/src/deploy_chatmail/cmdeploy.py +++ b/deploy-chatmail/src/deploy_chatmail/cmdeploy.py @@ -146,13 +146,16 @@ def test_cmd(args, out, config): """Run local and online tests.""" tox = shutil.which("tox") - subprocess.check_call([tox, "-c", "chatmaild"]) - subprocess.check_call([tox, "-c", "deploy-chatmail"]) + proc1 = subprocess.run([tox, "-c", "chatmaild"]) + proc2 = subprocess.run([tox, "-c", "deploy-chatmail"]) pytest_path = shutil.which("pytest") - subprocess.check_call( + proc3 = subprocess.run( [pytest_path, "tests/online", "-rs", "-x", "-vrx", "--durations=5"] ) + if any(x.returncode != 0 for x in (proc1, proc2, proc3)): + return 1 + return 0 def bench_cmd(args, out, config): @@ -220,7 +223,7 @@ def main(args=None): raise SystemExit(1) try: - args.func(args, out, **kwargs) + sys.exit(args.func(args, out, **kwargs)) except KeyboardInterrupt: out.red("KeyboardInterrupt") sys.exit(130)