925 bytes · last changed 2026-10-27 in Networks: any hub starts one, pyrtan.com publishes the default; release 0.10.0
| 1 | from pathlib import Path |
| 2 | |
| 3 | import pytest |
| 4 | |
| 5 | from pyrtan import Registry, RecordedTransport, Runner |
| 6 | |
| 7 | ROOT = Path(__file__).resolve().parent.parent |
| 8 | EXAMPLES = ROOT / "examples" |
| 9 | FIXTURES = Path(__file__).resolve().parent / "fixtures" |
| 10 | |
| 11 | |
| 12 | @pytest.fixture |
| 13 | def examples() -> Registry: |
| 14 | reg = Registry.from_paths([EXAMPLES]) |
| 15 | assert not reg.errors, reg.errors |
| 16 | return reg |
| 17 | |
| 18 | |
| 19 | @pytest.fixture |
| 20 | def recorded() -> RecordedTransport: |
| 21 | return RecordedTransport.from_file(FIXTURES / "examples.json") |
| 22 | |
| 23 | |
| 24 | @pytest.fixture |
| 25 | def runner(examples: Registry, recorded: RecordedTransport) -> Runner: |
| 26 | return Runner(examples, recorded) |
| 27 | |
| 28 | |
| 29 | @pytest.fixture(autouse=True) |
| 30 | def _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")) |