Keep unit checks independent of external exchange-rate network
This commit is contained in:
parent
13ad21082c
commit
6e600b904a
1 changed files with 13 additions and 0 deletions
|
|
@ -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"))
|
||||
|
|
|
|||
Loading…
Reference in a new issue