mirror of
https://github.com/calesthio/OpenMontage.git
synced 2026-08-05 15:20:40 +08:00
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.
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user