26 lines
840 B
Python
26 lines
840 B
Python
from __future__ import annotations
|
|
|
|
import importlib.util
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
SCRIPT = ROOT / "scripts" / "verify_repository_layout.py"
|
|
SPEC = importlib.util.spec_from_file_location("verify_repository_layout", SCRIPT)
|
|
assert SPEC and SPEC.loader
|
|
MODULE = importlib.util.module_from_spec(SPEC)
|
|
SPEC.loader.exec_module(MODULE)
|
|
|
|
|
|
def test_nested_repository_mirror_is_absent() -> None:
|
|
assert MODULE.nested_mirror_markers(ROOT) == []
|
|
|
|
|
|
def test_nested_repository_mirror_is_detected(tmp_path: Path) -> None:
|
|
for marker in MODULE.CANONICAL_MARKERS:
|
|
path = tmp_path / "geointel" / marker
|
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
path.write_text("fixture", encoding="utf-8")
|
|
|
|
assert MODULE.nested_mirror_markers(tmp_path) == list(MODULE.CANONICAL_MARKERS)
|