diff --git a/tests/conftest.py b/tests/conftest.py index fde9ee6..19f6a26 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -30,3 +30,16 @@ def tmp_paths(tmp_path: pytest.TempPathFactory) -> AppPaths: ) paths.ensure_exists() return paths + + +@pytest.fixture(autouse=True) +def offline_unit_environment(monkeypatch): + """Unit checks never depend on exchange-rate services or network access.""" + import socket + from decimal import Decimal + + def reject_connection(*args, **kwargs): + raise AssertionError("Unit tests must use an explicit network fake") + + monkeypatch.setattr(socket, "create_connection", reject_connection) + monkeypatch.setattr("voice_dictation.core.fx.get_rate", lambda: Decimal("100"))