mirror of
https://github.com/darkzoul5/YoutubePlaylistSync.git
synced 2026-09-19 21:12:20 +03:00
Refactor test configuration and streamline test_cli_flags.py
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
class TempConfig:
|
||||||
|
"""Small test configuration object used by unit and integration tests.
|
||||||
|
|
||||||
|
Adjust attributes via environment variables where appropriate.
|
||||||
|
"""
|
||||||
|
yt_dlp_path = os.getenv("YTDLP_PATH", "yt-dlp")
|
||||||
|
ffmpeg_path = os.getenv("FFMPEG_PATH", "ffmpeg")
|
||||||
|
aria2c_path = os.getenv("ARIA2C_PATH", "aria2c")
|
||||||
|
max_parallel_downloads = int(os.getenv("TEST_MAX_PARALLEL", "2"))
|
||||||
|
aria2c_connections = int(os.getenv("TEST_ARIA2C_CONN", "2"))
|
||||||
|
download_mode = os.getenv("TEST_DOWNLOAD_MODE", "audio")
|
||||||
|
max_video_quality = os.getenv("TEST_MAX_VIDEO_QUALITY", "1080p")
|
||||||
|
# runtime flags
|
||||||
|
debug = False
|
||||||
|
non_interactive = False
|
||||||
|
prune = False
|
||||||
+6
-14
@@ -1,29 +1,21 @@
|
|||||||
import logging
|
import logging
|
||||||
from ytplaylist.manager import PlaylistManager
|
from ytplaylist.manager import PlaylistManager
|
||||||
|
from tests.temp_config import TempConfig
|
||||||
|
|
||||||
class test:
|
|
||||||
playlists=[{"url": None, "save_path":"./tmp_test", "archive":"archive.txt"}]
|
class TestConfig(TempConfig):
|
||||||
yt_dlp_path="./bin/yt-dlp"
|
playlists = [{"url": None, "save_path": "./tmp_test", "archive": "archive.txt"}]
|
||||||
ffmpeg_path="./bin/ffmpeg"
|
|
||||||
aria2c_path="./bin/ aria2c"
|
|
||||||
max_parallel_downloads=2
|
|
||||||
aria2c_connections=2
|
|
||||||
download_mode = "audio"
|
|
||||||
max_video_quality = "1080p"
|
|
||||||
debug=False
|
|
||||||
non_interactive=False
|
|
||||||
prune=False
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
logging.basicConfig(level=logging.INFO, format="%(levelname)s:%(message)s")
|
logging.basicConfig(level=logging.INFO, format="%(levelname)s:%(message)s")
|
||||||
print('--- Running with prune=False ---')
|
print('--- Running with prune=False ---')
|
||||||
cfg=test()
|
cfg=TestConfig()
|
||||||
m=PlaylistManager(cfg, debug=False)
|
m=PlaylistManager(cfg, debug=False)
|
||||||
m.run()
|
m.run()
|
||||||
print('Run complete prune=False')
|
print('Run complete prune=False')
|
||||||
|
|
||||||
print('\n--- Running with prune=True, non_interactive=True ---')
|
print('\n--- Running with prune=True, non_interactive=True ---')
|
||||||
cfg2=test()
|
cfg2=TestConfig()
|
||||||
cfg2.prune=True
|
cfg2.prune=True
|
||||||
cfg2.non_interactive=True
|
cfg2.non_interactive=True
|
||||||
m2=PlaylistManager(cfg2, debug=False)
|
m2=PlaylistManager(cfg2, debug=False)
|
||||||
|
|||||||
Reference in New Issue
Block a user