forked from ChelseaKR/nearmiss
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
31 lines (20 loc) · 825 Bytes
/
Copy pathconftest.py
File metadata and controls
31 lines (20 loc) · 825 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
"""Shared pytest fixtures: the demo config and a cached analysis bundle."""
from __future__ import annotations
import json
from pathlib import Path
import pytest
from nearmiss.config import Config, load_config
from nearmiss.engine import AnalysisBundle, build_analysis
ROOT = Path(__file__).resolve().parents[1]
CONFIG_PATH = ROOT / "config" / "davis-demo.toml"
REPORTS_PATH = ROOT / "tests" / "fixtures" / "davis" / "reports.json"
@pytest.fixture(scope="session")
def config() -> Config:
return load_config(CONFIG_PATH)
@pytest.fixture(scope="session")
def bundle(config: Config) -> AnalysisBundle:
return build_analysis(config)
@pytest.fixture(scope="session")
def a_valid_report() -> dict[str, object]:
data = json.loads(REPORTS_PATH.read_text(encoding="utf-8"))
return dict(data["reports"][0])