34 lines
1015 B
Python
34 lines
1015 B
Python
from __future__ import annotations
|
|||
|
|
|
||
|
|
import importlib.util
|
||
|
|
from pathlib import Path
|
||
|
|
import unittest
|
||
|
|
|
||
|
|
|
||
|
|
ROOT = Path(__file__).resolve().parents[1]
|
||
|
|
SPEC = importlib.util.spec_from_file_location(
|
||
|
|
"validate_repository", ROOT / "scripts" / "validate_repository.py"
|
||
|
|
)
|
||
|
|
VALIDATOR = importlib.util.module_from_spec(SPEC)
|
||
|
|
assert SPEC.loader is not None
|
||
|
|
SPEC.loader.exec_module(VALIDATOR)
|
||
|
|
|
||
|
|
|
||
|
|
class RepositoryTests(unittest.TestCase):
|
||
|
|
def test_repository_passes(self) -> None:
|
||
|
|
self.assertEqual([], VALIDATOR.validate(ROOT))
|
||
|
|
|
||
|
|
def test_every_markdown_report_is_indexed(self) -> None:
|
||
|
|
import json
|
||
|
|
|
||
|
|
index = json.loads((ROOT / "content-index.json").read_text(encoding="utf-8"))
|
||
|
|
indexed = {item["path"] for item in index["items"]}
|
||
|
|
reports = {
|
||
|
|
path.relative_to(ROOT).as_posix()
|
||
|
|
for path in (ROOT / "research-results").glob("*ai-opportunity-skill-results.md")
|
||
|
|
}
|
||
|
|
self.assertEqual(reports, indexed)
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
unittest.main()
|