mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-11-12 08:40:27 +08:00
test_chain_rate_limit.py and test_system_notification_dispatch.py installed a bare qbittorrentapi/transmission_rpc/psutil ModuleType into sys.modules at import time with sys.modules.setdefault. When either file is collected before a test that imports the real package in the same shard (for example tests/test_downloader_add_failure_message.py and its TorrentDictionary import), the placeholder wins and collection fails with "cannot import name ... (unknown location)". Any change to the test file set reshuffles the six CI shards and can surface this. Use app.testing.bootstrap.ensure_optional_stub, which keeps the real module when it is installed, and convert both unittest.TestCase files to pytest-native functions as the testing guide requires when touching a TestCase file. Record the resulting lower Ruff watermark. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>