from __future__ import annotations import subprocess import sys import unittest from pathlib import Path ROOT = Path(__file__).resolve().parents[1] # Every environment probe.py gates. A new environment that is not added here still has to # print "ok", because the count assertion below counts them — so this list going stale fails # the build rather than quietly narrowing what the test covers. ENVIRONMENTS = ( "redaction-pressure", "canary-trap", "fault-localisation", "schema-migration", "bot-detection", "grand-exchange", "drop-table-inference", ) class RootProbeIntegrationTests(unittest.TestCase): def test_public_root_probe_gates_every_environment(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()