This commit is contained in:
eddiesoehnel committed 2026-07-24 15:14:23 -06:00
1 parent 614d235bbe
commit 1e52a733d1
29 files changed
+728 -66

No files matched your search

+3 -1
View File
@@ -6,4 +6,6 @@ Run the dependency-free unit tests with:
python -m unittest discover -s tests -p "test_*.py"
```
The tests validate the current repository and protect key failure cases in `scripts/validate_repository.py`.
The tests validate the current repository and protect key failure cases in
`scripts/validate_repository.py`, including mismatches between
`repository-variables.json` and `repository.json`.
+20
View File
@@ -1,7 +1,9 @@
from __future__ import annotations
import importlib.util
import json
from pathlib import Path
import shutil
import tempfile
import unittest
@@ -27,6 +29,24 @@ class RepositoryValidationTests(unittest.TestCase):
any("Missing required path" in item["message"] for item in result["findings"])
)
def test_variable_identity_mismatch_fails(self) -> None:
with tempfile.TemporaryDirectory() as directory:
copy = Path(directory) / "repository"
shutil.copytree(ROOT, copy, ignore=shutil.ignore_patterns(".git", "__pycache__"))
variables_path = copy / "repository-variables.json"
variables = json.loads(variables_path.read_text(encoding="utf-8"))
variables["identity"]["publisher"]["name"] = "Different Publisher"
variables_path.write_text(json.dumps(variables, indent=2) + "\n", encoding="utf-8")
result = VALIDATOR.validate(copy)
self.assertFalse(result["passed"])
self.assertTrue(
any(
"Publisher differs between repository-variables.json and repository.json"
in item["message"]
for item in result["findings"]
)
)
if __name__ == "__main__":
unittest.main()