from __future__ import annotations import subprocess import sys import unittest from pathlib import Path ROOT = Path(__file__).resolve().parents[1] ENVIRONMENTS = ( "redaction-pressure", "canary-trap", "fault-localisation", "schema-migration", ) class RootProbeIntegrationTests(unittest.TestCase): def test_public_root_probe_gates_all_four_environments(self) -> None: completed = subprocess.run( [sys.executable, "probe.py"], cwd=ROOT, text=True, capture_output=True, timeout=30, check=False, ) self.assertEqual( completed.returncode, 0, msg=f"root probe failed:\nstdout:\n{completed.stdout}\nstderr:\n{completed.stderr}", ) for environment in ENVIRONMENTS: with self.subTest(environment=environment): self.assertIn(environment, completed.stdout) self.assertEqual(completed.stdout.count(" ok"), len(ENVIRONMENTS)) if __name__ == "__main__": unittest.main()