forked from ChelseaKR/tods-validate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
32 lines (22 loc) · 900 Bytes
/
Copy pathconftest.py
File metadata and controls
32 lines (22 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from pathlib import Path
import pytest
from tods_validate.findings import Finding
from tods_validate.runner import run
FIXTURES = Path(__file__).parent / "fixtures"
VALID_TODS = FIXTURES / "valid" / "tods"
VALID_GTFS = FIXTURES / "valid" / "gtfs"
def run_invalid_fixture(rule_id: str) -> list[Finding]:
"""Validate the broken fixture dedicated to one rule.
Fixtures that need a companion GTFS feed keep the GTFS files in the same
directory; the runner picks them up automatically.
"""
path = FIXTURES / "invalid" / rule_id
assert path.is_dir(), f"missing fixture directory for {rule_id}"
_, findings = run(path)
return findings
def rule_ids(findings: list[Finding]) -> set[str]:
return {f.rule_id for f in findings}
@pytest.fixture(scope="session")
def valid_findings() -> list[Finding]:
_, findings = run(VALID_TODS, VALID_GTFS)
return findings