diff --git a/scripts/run-python-tests.py b/scripts/run-python-tests.py index 61e61a46a6..a1d9df4a88 100644 --- a/scripts/run-python-tests.py +++ b/scripts/run-python-tests.py @@ -107,23 +107,17 @@ if not list(root.joinpath("tests/support/analysis-efficiency").glob("test_*.py") modules = [ ".".join(path.relative_to(root).with_suffix("").parts) for path in bridge_tests ] -if sys.argv[1:] == ["--bridge"]: - run_bridge(modules) +phases = { + "--bridge": lambda: run_bridge(modules), + "--analysis-efficiency": run_analysis_efficiency, +} +args = sys.argv[1:] +if len(args) == 1 and args[0] in phases: + phases[args[0]]() raise SystemExit(0) -if sys.argv[1:] == ["--analysis-efficiency"]: - run_analysis_efficiency() - raise SystemExit(0) -if sys.argv[1:]: +if args: fail("invalid_python_test_arguments") -bridge_result = subprocess.run( - [sys.executable, __file__, "--bridge"], cwd=root, check=False -) -if bridge_result.returncode: - sys.exit(bridge_result.returncode) -result = subprocess.run( - [sys.executable, __file__, "--analysis-efficiency"], - cwd=root, - check=False, -) -if result.returncode: - sys.exit(result.returncode) +for phase in phases: + result = subprocess.run([sys.executable, __file__, phase], cwd=root, check=False) + if result.returncode: + sys.exit(result.returncode)