Keep unit checks independent of external exchange-rate network

This commit is contained in:
Vickenty Zherebov 2026-10-19 15:19:41 +03:00
parent 13ad21082c
commit 6e600b904a

View file

@ -30,3 +30,16 @@ def tmp_paths(tmp_path: pytest.TempPathFactory) -> AppPaths:
) )
paths.ensure_exists() paths.ensure_exists()
return paths 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"))