Spaces:
Running
Running
File size: 843 Bytes
fb7515e | 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 | """Shared fixtures: no test may hit the network.
The single live Open-Meteo call was recorded once to
``tests/fixtures/openmeteo_bells.json``. Here every HTTP attempt fails
fast so an accidental network dependency surfaces as an error, while
stale-cache fallback paths still work (they catch ``httpx.HTTPError``).
"""
import sys
from pathlib import Path
import httpx
import pytest
# Repo root on sys.path so `wavereader` imports however pytest is invoked
# (subset runs must not depend on other test modules' bootstraps).
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
@pytest.fixture(autouse=True)
def _no_network(monkeypatch):
class _DeadClient:
def __init__(self, *a, **k):
raise httpx.ConnectError("network disabled in tests")
monkeypatch.setattr(httpx, "Client", _DeadClient)
yield
|