Lab2 grade 4: PostgreSQL, Redis sessions, Compose, student tests and evidence.

This commit is contained in:
2026-10-30 12:37:18 +03:00
parent 65003b6119
commit 950ff93573
34 changed files with 2252 additions and 41 deletions
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env python3
"""Run all student tests against a live API (BASE_URL)."""
from __future__ import annotations
import importlib
import sys
import traceback
MODULES = [
"test_api",
"test_concurrency",
"test_sessions",
"test_deps",
]
def main() -> int:
failed = 0
passed = 0
for name in MODULES:
mod = importlib.import_module(name)
tests = [getattr(mod, n) for n in dir(mod) if n.startswith("test_")]
for fn in tests:
label = f"{name}.{fn.__name__}"
try:
fn()
print("OK", label)
passed += 1
except Exception as exc:
failed += 1
print("FAIL", label, ":", exc)
traceback.print_exc()
print(f"Summary: {passed} passed, {failed} failed")
return 1 if failed else 0
if __name__ == "__main__":
sys.path.insert(0, ".")
raise SystemExit(main())