generated from coulomb/repo-seed
fixture-repository coverage for the testing strategy
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
from repo_registry.repo_scanning.scanner import DeterministicScanner
|
||||
from tests.fixtures import (
|
||||
write_misleading_docs_repo,
|
||||
write_python_cli_repo,
|
||||
write_readme_only_repo,
|
||||
)
|
||||
|
||||
|
||||
def test_deterministic_scanner_extracts_structural_facts(tmp_path):
|
||||
@@ -34,3 +39,35 @@ def test_deterministic_scanner_extracts_structural_facts(tmp_path):
|
||||
|
||||
languages = {fact.name: fact.metadata["file_count"] for fact in result.facts if fact.kind == "language"}
|
||||
assert languages == {"Python": 2}
|
||||
|
||||
|
||||
def test_scanner_readme_only_fixture_records_docs_without_interfaces(tmp_path):
|
||||
repo = write_readme_only_repo(tmp_path)
|
||||
|
||||
result = DeterministicScanner().scan(repo)
|
||||
|
||||
facts = {(fact.kind, fact.name, fact.path) for fact in result.facts}
|
||||
assert ("documentation", "README", "README.md") in facts
|
||||
assert {fact.kind for fact in result.facts} == {"documentation"}
|
||||
|
||||
|
||||
def test_scanner_python_cli_fixture_records_cli_and_framework_hints(tmp_path):
|
||||
repo = write_python_cli_repo(tmp_path)
|
||||
|
||||
result = DeterministicScanner().scan(repo)
|
||||
|
||||
facts = {(fact.kind, fact.name, fact.path) for fact in result.facts}
|
||||
assert ("framework", "Click", "requirements.txt") in facts
|
||||
assert ("framework", "pytest", "requirements.txt") in facts
|
||||
assert ("interface", "python CLI command decorator", "cli.py") in facts
|
||||
assert ("test", "test_cli.py", "tests/test_cli.py") in facts
|
||||
|
||||
|
||||
def test_scanner_misleading_docs_fixture_stays_observational(tmp_path):
|
||||
repo = write_misleading_docs_repo(tmp_path)
|
||||
|
||||
result = DeterministicScanner().scan(repo)
|
||||
|
||||
assert [(fact.kind, fact.name, fact.path) for fact in result.facts] == [
|
||||
("documentation", "README", "README.md")
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user