diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee02e11..584b147 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,13 +13,17 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.11" - # Tests only touch light modules (subtitles/hooks/translate/edit_builder - # and the cloud metering helpers), so we install just what they import - # instead of the full requirements.txt (faster-whisper/ultralytics/ - # mediapipe are too heavy for CI). sqlalchemy is needed because - # tests/test_metering_free_plan.py imports cloud.metering. + # Everything the collected tests import at module level, WITHOUT the + # heavy ML stack (torch/ultralytics/mediapipe/faster-whisper) — the + # pipeline modules import those lazily behind their feature gates, and + # the tests exercise the gated-off paths. numpy+opencv cover the layout + # modules, fastapi/boto3/PyJWT/python-multipart cover importing app.py + # for the MCP endpoint tests, google-genai covers gemini_worker. - name: Install test dependencies - run: pip install pytest pillow httpx pydantic sqlalchemy + run: > + pip install pytest pillow httpx pydantic sqlalchemy numpy + opencv-python-headless python-dotenv google-genai fastapi boto3 + PyJWT email-validator python-multipart - name: Run tests run: pytest tests/ -v diff --git a/panel_layout.py b/panel_layout.py index 2c23639..c04f286 100644 --- a/panel_layout.py +++ b/panel_layout.py @@ -218,11 +218,12 @@ def detect_panel_scenes(video_path, scenes, strategies, samples=None): same reason SPLIT does it: GENERAL already means "more than one face", and single-speaker material is most of the corpus and must not be touched. """ - import cv2 - import main as m - if not ENABLED: return {} + # Below the gate on purpose: main pulls torch/mediapipe, and the disabled + # path (the default, and what CI exercises) must not pay that import. + import cv2 + import main as m cap = cv2.VideoCapture(video_path) if not cap.isOpened(): diff --git a/screencast_layout.py b/screencast_layout.py index 19b17f9..ad7d2fa 100644 --- a/screencast_layout.py +++ b/screencast_layout.py @@ -245,11 +245,12 @@ def detect_screencast_scenes(video_path, scenes, strategies, ranges, samples=6): - WIDE is the blurred layout with side-cropping disabled, for content that fills the frame, or that has no presenter to stack. """ - import cv2 - import main as m - if not ENABLED or not ranges: return {} + # Below the gate on purpose: main pulls torch/mediapipe, and the disabled + # path (the default, and what CI exercises) must not pay that import. + import cv2 + import main as m cap = cv2.VideoCapture(video_path) if not cap.isOpened():