refactor(evidence): remove legacy Python layout (#31)
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
HARNESS_ROOT = Path(__file__).resolve().parents[1]
|
||||
LEGACY_PATHS = (
|
||||
"tht/ports/evidence.py",
|
||||
"tht/adapters/evidence",
|
||||
"tht/corpus",
|
||||
"tht/search/evidence.py",
|
||||
"tht/session/artifacts.py",
|
||||
)
|
||||
LEGACY_REFERENCES = (
|
||||
"tht.ports.evidence",
|
||||
"tht.adapters.evidence",
|
||||
"tht.corpus",
|
||||
"tht.search.evidence",
|
||||
"tht.session.artifacts",
|
||||
"build_evidence_sources",
|
||||
"build_evidence_entries",
|
||||
)
|
||||
|
||||
|
||||
def test_replaced_evidence_layout_is_removed():
|
||||
remaining = [path for path in LEGACY_PATHS if (HARNESS_ROOT / path).exists()]
|
||||
|
||||
assert remaining == []
|
||||
|
||||
|
||||
def test_production_and_tests_use_only_the_evidence_module():
|
||||
offenders = []
|
||||
for root in (HARNESS_ROOT / "tht", HARNESS_ROOT / "tests"):
|
||||
for path in root.rglob("*.py"):
|
||||
if path == Path(__file__).resolve() or "__pycache__" in path.parts:
|
||||
continue
|
||||
contents = path.read_text(encoding="utf-8")
|
||||
matched = [reference for reference in LEGACY_REFERENCES if reference in contents]
|
||||
if matched:
|
||||
offenders.append((path.relative_to(HARNESS_ROOT).as_posix(), matched))
|
||||
|
||||
assert offenders == []
|
||||
Reference in New Issue
Block a user