pyrtan / sourcev0.14.0 · main

pyrtan / tests / conftest.py

925 bytes · last changed 2026-10-27 in Networks: any hub starts one, pyrtan.com publishes the default; release 0.10.0

1from pathlib import Path
2
3import pytest
4
5from pyrtan import Registry, RecordedTransport, Runner
6
7ROOT = Path(__file__).resolve().parent.parent
8EXAMPLES = ROOT / "examples"
9FIXTURES = Path(__file__).resolve().parent / "fixtures"
10
11
12@pytest.fixture
13def examples() -> Registry:
14 reg = Registry.from_paths([EXAMPLES])
15 assert not reg.errors, reg.errors
16 return reg
17
18
19@pytest.fixture
20def recorded() -> RecordedTransport:
21 return RecordedTransport.from_file(FIXTURES / "examples.json")
22
23
24@pytest.fixture
25def runner(examples: Registry, recorded: RecordedTransport) -> Runner:
26 return Runner(examples, recorded)
27
28
29@pytest.fixture(autouse=True)
30def _no_default_network(monkeypatch, tmp_path):
31 """No test reads the default network from pyrtan.com; one that wants a
32 default network points $PYRTAN_NETWORK at a file of its own."""
33 monkeypatch.setenv("PYRTAN_NETWORK", str(tmp_path / "no-default-network.json"))