World's first open-source, agentic video production system. 12 production pipelines, 100+ tools, 700+ agent skill and production-knowledge files. Turn your AI coding assistant into a full video production studio.
Python agentagentic-aiaiclaudecopilotcursorelevenlabsffmpegfluximage-generationopen-sourceopenaipythonremotionstable-diffusiontext-to-speechtext-to-videovideo-generationvideo-production
fix(ci): isolate requests module tests
calesthio015809c103e6
diff --git a/tests/contracts/test_dashscope_tools.py b/tests/contracts/test_dashscope_tools.pyindex d9c001b8..d0d4b55e 100644--- a/tests/contracts/test_dashscope_tools.py+++ b/tests/contracts/test_dashscope_tools.py@@ -147,15 +147,14 @@ class TestContract:tool = cls()assert len(tool.user_visible_verification) > 0- def test_lazy_imports_requests(self, cls):+ def test_lazy_imports_requests(self, cls, monkeypatch):"""Tool module must not import requests at top level (registrydiscovery must stay fast)."""import importlibimport sys# Remove requests from cache to simulate fresh importmod_name = cls.__module__- if "requests" in sys.modules:- del sys.modules["requests"]+ monkeypatch.delitem(sys.modules, "requests", raising=False)# Re-import the tool module — should not pull in requests# (requests is imported inside execute(), not at module level)importlib.reload(sys.modules[mod_name])diff --git a/tests/tools/test_music_gen_force_instrumental.py b/tests/tools/test_music_gen_force_instrumental.pyindex 0a62a4ae..b2abc759 100644--- a/tests/tools/test_music_gen_force_instrumental.py+++ b/tests/tools/test_music_gen_force_instrumental.py@@ -25,7 +25,10 @@ class _FakeResponse:return None-def _install_fake_requests(captured: dict) -> types.ModuleType:+def _install_fake_requests(+ monkeypatch: pytest.MonkeyPatch,+ captured: dict,+) -> types.ModuleType:"""Install a stub ``requests`` module that records the JSON payload."""fake = types.ModuleType("requests")@@ -36,24 +39,25 @@ def _install_fake_requests(captured: dict) -> types.ModuleType:return _FakeResponse()fake.post = fake_post- sys.modules["requests"] = fake+ monkeypatch.setitem(sys.modules, "requests", fake)return fakedef test_force_instrumental_is_sent_true_by_default(monkeypatch, tmp_path):monkeypatch.setenv("ELEVENLABS_API_KEY", "test-key")captured: dict = {}- _install_fake_requests(captured)+ _install_fake_requests(monkeypatch, captured)# Route the output to tmp_path so the test never writes music_output.mp3# into the repo root (the default output_path).out = tmp_path / "bg.mp3"- try:- MusicGen()._generate(- {"prompt": "gentle ambient", "duration_seconds": 10, "output_path": str(out)},- "test-key",- )- finally:- sys.modules.pop("requests", None)+ MusicGen()._generate(+ {+ "prompt": "gentle ambient",+ "duration_seconds": 10,+ "output_path": str(out),+ },+ "test-key",+ )assert "force_instrumental" in captured["payload"], "force_instrumental kwarg was never sent"assert captured["payload"]["force_instrumental"] is True@@ -63,20 +67,17 @@ def test_force_instrumental_is_sent_true_by_default(monkeypatch, tmp_path):def test_explicit_vocal_opt_out_is_respected(monkeypatch, tmp_path):monkeypatch.setenv("ELEVENLABS_API_KEY", "test-key")captured: dict = {}- _install_fake_requests(captured)+ _install_fake_requests(monkeypatch, captured)out = tmp_path / "vocals.mp3"- try:- MusicGen()._generate(- {- "prompt": "lead vocal pop",- "duration_seconds": 10,- "force_instrumental": False,- "output_path": str(out),- },- "test-key",- )- finally:- sys.modules.pop("requests", None)+ MusicGen()._generate(+ {+ "prompt": "lead vocal pop",+ "duration_seconds": 10,+ "force_instrumental": False,+ "output_path": str(out),+ },+ "test-key",+ )assert captured["payload"]["force_instrumental"] is Falsediff --git a/tests/tools/test_pixabay_per_page_clamp.py b/tests/tools/test_pixabay_per_page_clamp.pyindex a05a496e..26bdb6a9 100644--- a/tests/tools/test_pixabay_per_page_clamp.py+++ b/tests/tools/test_pixabay_per_page_clamp.py@@ -1,8 +1,6 @@"""Pixabay rejects per_page outside 3-200 with HTTP 400, so everyPixabay caller must clamp before building the request."""-import requests-from tools.graphics.pixabay_image import PixabayImagefrom tools.video.pixabay_video import PixabayVideofrom tools.video.stock_sources.base import SearchFilters@@ -25,10 +23,16 @@ def _capture_get(captured):return fake_get+def _patch_requests_get(monkeypatch, captured):+ import requests++ monkeypatch.setattr(requests, "get", _capture_get(captured))++def test_pixabay_video_tool_clamps_per_page(monkeypatch):monkeypatch.setenv("PIXABAY_API_KEY", "test-key")captured = {}- monkeypatch.setattr(requests, "get", _capture_get(captured))+ _patch_requests_get(monkeypatch, captured)PixabayVideo().execute({"query": "sky", "per_page": 1})assert captured["params"]["per_page"] == 3@@ -40,7 +44,7 @@ def test_pixabay_video_tool_clamps_per_page(monkeypatch):def test_pixabay_image_tool_clamps_per_page(monkeypatch):monkeypatch.setenv("PIXABAY_API_KEY", "test-key")captured = {}- monkeypatch.setattr(requests, "get", _capture_get(captured))+ _patch_requests_get(monkeypatch, captured)PixabayImage().execute({"query": "sky", "per_page": 1})assert captured["params"]["per_page"] == 3@@ -52,7 +56,7 @@ def test_pixabay_image_tool_clamps_per_page(monkeypatch):def test_pixabay_stock_source_clamps_per_page(monkeypatch):monkeypatch.setenv("PIXABAY_API_KEY", "test-key")captured = {}- monkeypatch.setattr(requests, "get", _capture_get(captured))+ _patch_requests_get(monkeypatch, captured)source = PixabayVideoSource()source.search("sky", SearchFilters(per_page=1))