50 lines
1.7 KiB
Python
50 lines
1.7 KiB
Python
import json
|
|
import subprocess
|
|
import sys
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
|
|
PROJECT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
class ProjectScaffoldTests(unittest.TestCase):
|
|
def test_colab_notebook_is_valid_plain_python(self):
|
|
result = subprocess.run(
|
|
[
|
|
sys.executable,
|
|
"tools/run_colab_notebook.py",
|
|
"notebooks/quant_os_colab.ipynb",
|
|
],
|
|
cwd=PROJECT,
|
|
check=True,
|
|
capture_output=True,
|
|
text=True,
|
|
)
|
|
payload = json.loads(result.stdout.strip().splitlines()[-1])
|
|
self.assertTrue(payload["ok"])
|
|
self.assertGreaterEqual(payload["code_cells"], 5)
|
|
self.assertFalse(payload["executed"])
|
|
|
|
def test_secret_files_are_ignored(self):
|
|
ignore = (PROJECT / ".gitignore").read_text(encoding="utf-8")
|
|
for entry in (".env", "secrets/", "credentials/", "userdata_mini/"):
|
|
self.assertIn(entry, ignore)
|
|
|
|
def test_claude_project_contract_exists(self):
|
|
content = (PROJECT / "CLAUDE.md").read_text(encoding="utf-8")
|
|
self.assertIn("executable source of truth for Quant OS", content)
|
|
self.assertIn("make local", content)
|
|
|
|
def test_gitea_workflow_is_at_monorepo_root(self):
|
|
workflow = PROJECT.parent / ".gitea/workflows/quant-os-ci.yml"
|
|
self.assertTrue(workflow.is_file())
|
|
content = workflow.read_text(encoding="utf-8")
|
|
self.assertIn("working-directory: quant-os", content)
|
|
self.assertIn("bash scripts/validate_all.sh", content)
|
|
self.assertFalse((PROJECT / ".gitea/workflows/ci.yml").exists())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|