diff --git a/tests/unit/test_batch_download.py b/tests/unit/test_batch_download.py index 345917875..58c669bce 100755 --- a/tests/unit/test_batch_download.py +++ b/tests/unit/test_batch_download.py @@ -7,7 +7,6 @@ and _download_video_to_file helper. from __future__ import annotations import io -import sys import zipfile from pathlib import Path from unittest.mock import MagicMock, patch @@ -245,19 +244,7 @@ def test_batch_download_single_video(): def test_batch_download_session_closed(): - """DB session is always closed (via finally block). - - NOTE: Some prior tests in the full suite replace sys.modules['worker_app.db'] - with a MagicMock, causing 'from worker_app.db import SessionLocal' to get a - mock. We ensure the real module is restored before testing. - """ - # Restore real worker_app.db module if it was mocked by a prior test - import types - if not isinstance(sys.modules.get("worker_app.db"), types.ModuleType): - # Remove the mock and re-import the real module - sys.modules.pop("worker_app.db", None) - import worker_app.db # noqa: F401 — re-import real module - + """DB session is always closed (via finally block).""" videos = [_FakeVideo("v1", "v.mp4")] session = MagicMock()