mirror of
https://github.com/darkzoul5/YoutubePlaylistSync.git
synced 2026-09-22 06:12:21 +03:00
Refactor test configurations and enhance testing framework
- Replace TempConfig with DummyConfig across tests for consistency - Introduce unit tests workflow configuration - Add pytest configuration for standardized test discovery - Implement comprehensive tests for config loading and downloader behavior - Clean up unused temp_config.py and related references
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import logging
|
||||
from tests.dummy_config import DummyConfig
|
||||
from ytplaylist.manager import PlaylistManager
|
||||
|
||||
|
||||
def test_manager_warns_and_sleeps(monkeypatch, caplog):
|
||||
# Avoid actually sleeping during the test
|
||||
slept = {"called": False}
|
||||
|
||||
def fake_sleep(sec):
|
||||
slept["called"] = True
|
||||
|
||||
# monkeypatch the sleep used inside the manager module
|
||||
monkeypatch.setattr("ytplaylist.manager.time.sleep", fake_sleep)
|
||||
|
||||
caplog.set_level(logging.WARNING)
|
||||
cfg = DummyConfig()
|
||||
cfg.max_parallel_downloads = 11
|
||||
cfg.aria2c_connections = 10
|
||||
cfg.playlists = []
|
||||
|
||||
m = PlaylistManager(cfg, debug=False)
|
||||
m.run()
|
||||
|
||||
assert slept["called"] is True
|
||||
assert any("may overload your network" in rec.getMessage() for rec in caplog.records)
|
||||
Reference in New Issue
Block a user