mirror of
https://github.com/darkzoul5/YoutubePlaylistSync.git
synced 2026-11-03 23:38:14 +02:00
Refactor test files: remove unused imports for improved clarity
This commit is contained in:
1 parent
d197e14425
commit
0d1c0403f2
4 files changed
+6
-14
No files matched your search
@@ -10,9 +10,11 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
import shutil
|
import shutil
|
||||||
from pathlib import Path
|
|
||||||
import time
|
import time
|
||||||
import shutil
|
from pathlib import Path
|
||||||
|
|
||||||
|
from src.downloader import PlaylistDownloader
|
||||||
|
from tests.dummy_config import DummyConfig
|
||||||
|
|
||||||
# Make imports robust when running the script directly from different working directories.
|
# Make imports robust when running the script directly from different working directories.
|
||||||
# Ensure the repository root and this tests folder are on sys.path so the script can import
|
# Ensure the repository root and this tests folder are on sys.path so the script can import
|
||||||
@@ -46,11 +48,6 @@ if bin_dir.exists():
|
|||||||
os.environ.setdefault("ARIA2C_PATH", str(aria2c_path))
|
os.environ.setdefault("ARIA2C_PATH", str(aria2c_path))
|
||||||
print(f"Using local aria2c at: {aria2c_path}")
|
print(f"Using local aria2c at: {aria2c_path}")
|
||||||
|
|
||||||
from src.downloader import PlaylistDownloader
|
|
||||||
from tests.dummy_config import DummyConfig
|
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO, format='%(levelname)s:%(message)s')
|
|
||||||
|
|
||||||
# allow caller to override playlist url via env
|
# allow caller to override playlist url via env
|
||||||
playlist_url = os.getenv("TEST_PLAYLIST_URL")
|
playlist_url = os.getenv("TEST_PLAYLIST_URL")
|
||||||
if not playlist_url:
|
if not playlist_url:
|
||||||
@@ -63,8 +60,7 @@ print(f"Using playlist URL: {playlist_url}")
|
|||||||
cfg_base = DummyConfig()
|
cfg_base = DummyConfig()
|
||||||
|
|
||||||
# ensure yt-dlp exists
|
# ensure yt-dlp exists
|
||||||
import shutil as _sh
|
if not shutil.which(str(cfg_base.yt_dlp_path)):
|
||||||
if not _sh.which(str(cfg_base.yt_dlp_path)):
|
|
||||||
print(f"yt-dlp binary not found at '{cfg_base.yt_dlp_path}'. Please install yt-dlp or set YTDLP_PATH environment variable.")
|
print(f"yt-dlp binary not found at '{cfg_base.yt_dlp_path}'. Please install yt-dlp or set YTDLP_PATH environment variable.")
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
@@ -128,7 +124,7 @@ for mode in MODES:
|
|||||||
# check archive has entries
|
# check archive has entries
|
||||||
archive_file = (save_path / f"archive_{mode}.txt")
|
archive_file = (save_path / f"archive_{mode}.txt")
|
||||||
if archive_file.exists():
|
if archive_file.exists():
|
||||||
lines = [l for l in archive_file.read_text(encoding='utf-8').splitlines() if l.strip()]
|
lines = [line for line in archive_file.read_text(encoding='utf-8').splitlines() if line.strip()]
|
||||||
print(f"Archive {archive_file} contains {len(lines)} lines")
|
print(f"Archive {archive_file} contains {len(lines)} lines")
|
||||||
if len(lines) < 3:
|
if len(lines) < 3:
|
||||||
print(f"Expected archive to contain >=3 lines, found {len(lines)}")
|
print(f"Expected archive to contain >=3 lines, found {len(lines)}")
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import json
|
import json
|
||||||
import shutil
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from src.config import ConfigLoader
|
from src.config import ConfigLoader
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import subprocess
|
import subprocess
|
||||||
import shutil
|
import shutil
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from src.downloader import PlaylistDownloader
|
from src.downloader import PlaylistDownloader
|
||||||
from tests.dummy_config import DummyConfig
|
from tests.dummy_config import DummyConfig
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import shutil
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from src.downloader import PlaylistDownloader
|
from src.downloader import PlaylistDownloader
|
||||||
|
|||||||
Reference in new issue
Block a user