| import unittest |
| from pathlib import Path |
|
|
|
|
| class RuntimeArtifactTests(unittest.TestCase): |
| def test_root_inference_script_exists(self) -> None: |
| inference_path = Path("inference.py") |
| self.assertTrue(inference_path.exists()) |
| content = inference_path.read_text(encoding="utf-8") |
| self.assertIn("API_BASE_URL", content) |
| self.assertIn("MODEL_NAME", content) |
| self.assertIn("HF_TOKEN", content) |
| self.assertIn("OpenAI", content) |
| self.assertIn("BASELINE_OUTPUT_MODE", content) |
|
|
| def test_openenv_manifest_lists_runtime_validation_endpoints(self) -> None: |
| manifest = Path("openenv.yaml").read_text(encoding="utf-8") |
| self.assertIn("metadata: GET /metadata", manifest) |
| self.assertIn("schema: GET /schema", manifest) |
| self.assertIn("mcp: POST /mcp", manifest) |
|
|
| def test_ci_workflow_runs_both_test_suites_and_docker_build(self) -> None: |
| workflow = Path(".github/workflows/ci.yml").read_text(encoding="utf-8") |
| self.assertIn("python pre_submission_check.py", workflow) |
| self.assertIn("python -m unittest discover -s tests", workflow) |
| self.assertIn("python -m unittest discover -s submission_tests", workflow) |
| self.assertIn("docker build -t idpi-exfil-env .", workflow) |
|
|
| def test_hf_sync_workflow_uses_configurable_space_repo(self) -> None: |
| workflow = Path(".github/workflows/sync.yml").read_text(encoding="utf-8") |
| self.assertIn("HF_SPACE_REPO", workflow) |
| self.assertIn("huggingface.co/spaces/${HF_SPACE_REPO}", workflow) |
|
|
| def test_pre_submission_script_exists(self) -> None: |
| script = Path("pre_submission_check.py") |
| self.assertTrue(script.exists()) |
| content = script.read_text(encoding="utf-8") |
| self.assertIn("inference_contract", content) |
| self.assertIn("structured_log_contract", content) |
| self.assertIn("openenv.cli", content) |
|
|
|
|
| if __name__ == "__main__": |
| unittest.main() |
|
|