From 8414c485adc151639bf4a6de658fc85fe218981d Mon Sep 17 00:00:00 2001 From: Yiyabo Date: Mon, 13 Jul 2026 12:55:27 +0800 Subject: [PATCH] fix: restore requests module after test_lazy_imports_requests Use monkeypatch.delitem instead of manual del sys.modules['requests'] so pytest automatically restores the module after the test. This prevents 12 downstream Google auth/music/Veo tests from failing with AttributeError: module 'requests' has no attribute 'exceptions'. Fixes calesthio's review feedback on PR #341. --- tests/contracts/test_jimeng_video.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/contracts/test_jimeng_video.py b/tests/contracts/test_jimeng_video.py index a5fd0f74..5cbf5dde 100644 --- a/tests/contracts/test_jimeng_video.py +++ b/tests/contracts/test_jimeng_video.py @@ -107,12 +107,12 @@ class TestContract: def test_has_user_visible_verification(self): assert len(JimengVideo().user_visible_verification) > 0 - def test_lazy_imports_requests(self): + def test_lazy_imports_requests(self, monkeypatch): import importlib import sys mod_name = "tools.video.jimeng_video" if "requests" in sys.modules: - del sys.modules["requests"] + monkeypatch.delitem(sys.modules, "requests") importlib.reload(sys.modules[mod_name]) def test_estimate_cost_returns_float(self):