#!/usr/bin/env python3 """Единая команда запуска собственных тестов. Запускает: test_negative.py, test_concurrency.py. Публичный smoke запускается отдельно.""" import subprocess import sys from pathlib import Path HERE = Path(__file__).resolve().parent def run_one(script, base_url): print("=== %s ===" % script.name) proc = subprocess.run( [sys.executable, str(script), "--base-url", base_url], cwd=str(HERE), ) if proc.returncode != 0: print("FAIL: %s" % script.name) return False return True def main(): import argparse p = argparse.ArgumentParser(description="Lab1 student tests (level 4)") p.add_argument("--base-url", default="http://localhost:8080") args = p.parse_args() ok = True for script in ("test_negative.py", "test_concurrency.py"): if not run_one(HERE / script, args.base_url): ok = False if not ok: raise SystemExit(1) print("PASS: all student tests (level 4) passed") if __name__ == "__main__": main()