Open raw ↗"""Empirical Challenger Test Suite for Gate 1 Verification.
Stress-tests functional correctness across both Python source and dist/HAD Digital.exe:
1. Multi-patient toxicity reporting & direct SQLite assertions
2. Multi-role access control matrix
3. High-volume and rapid concurrent sequential submissions (SQLite WAL concurrency)
4. CTCAE rule evaluation across boundary scores & malformed payloads
5. Persistence verification across server process kill and restart
"""
import subprocess
import sys
from pathlib import Path
import pytest
HARNESS_SCRIPT = Path(__file__).resolve().parent / "stress_harness.py"
class TestEmpiricalChallengesSource:
"""Run full empirical stress harness against Python source."""
def test_empirical_stress_harness_source(self):
res = subprocess.run(
[sys.executable, str(HARNESS_SCRIPT), "--source"],
capture_output=True,
text=True,
timeout=60,
)
assert res.returncode == 0, f"Source stress harness failed:\n{res.stdout}\n{res.stderr}"
class TestEmpiricalChallengesExe:
"""Run full empirical stress harness against standalone Windows executable."""
def test_empirical_stress_harness_exe(self):
exe_path = Path(__file__).resolve().parent.parent / "dist" / "HAD Digital.exe"
if not exe_path.exists():
pytest.skip("dist/HAD Digital.exe not found")
res = subprocess.run(
[sys.executable, str(HARNESS_SCRIPT), "--exe"],
capture_output=True,
text=True,
timeout=60,
)
assert res.returncode == 0, f"Standalone executable stress harness failed:\n{res.stdout}\n{res.stderr}"