added
This commit is contained in:
1 parent
92ef20cee0
commit
7af769f85e
46 files changed
+4417
-2
No files matched your search
@@ -0,0 +1,32 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
VALIDATOR_PATH = ROOT / "scripts" / "validate_repository.py"
|
||||
SPEC = importlib.util.spec_from_file_location("validate_repository", VALIDATOR_PATH)
|
||||
VALIDATOR = importlib.util.module_from_spec(SPEC)
|
||||
assert SPEC.loader is not None
|
||||
SPEC.loader.exec_module(VALIDATOR)
|
||||
|
||||
|
||||
class RepositoryValidationTests(unittest.TestCase):
|
||||
def test_current_repository_passes(self) -> None:
|
||||
result = VALIDATOR.validate(ROOT)
|
||||
self.assertTrue(result["passed"], result["findings"])
|
||||
|
||||
def test_missing_repository_fails(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
result = VALIDATOR.validate(Path(directory))
|
||||
self.assertFalse(result["passed"])
|
||||
self.assertTrue(
|
||||
any("Missing required path" in item["message"] for item in result["findings"])
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user