From 38d7abebfe8531672e94323b7435b1aaf7e99a07 Mon Sep 17 00:00:00 2001 From: XEDAB Date: Sun, 9 Aug 2026 14:26:38 +0800 Subject: [PATCH] fix: apply the download_file stub to moon_engine too (#160) --- tests/conftest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index a2001d1..aa0148d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -59,9 +59,10 @@ async def fake_shutdown_chrome(): monkeypatch.setattr(moon_extract, "shutdown_chrome", fake_shutdown_chrome) for host in (moon_engine, moon_cli): + # Every stub in this loop must cover both moon_engine and moon_cli. Break that and the engine keeps the real function — it will actually try to make network requests, because monkeypatch never replaced its download_file. monkeypatch.setattr(host, "extract_fuckingfast", fake_ff) monkeypatch.setattr(host, "extract_datanodes", fake_dn) monkeypatch.setattr(host, "close_ff_session", lambda: asyncio.sleep(0)) - monkeypatch.setattr(moon_cli, "download_file", fake_download) + monkeypatch.setattr(host, "download_file", fake_download) return calls