From 6e600b904a00b7e390baba4090ce55c407822423 Mon Sep 17 00:00:00 2001 From: Vickenty Zherebov Date: Mon, 19 Oct 2026 15:19:41 +0300 Subject: [PATCH] Keep unit checks independent of external exchange-rate network --- tests/conftest.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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"))