1
0
mirror of https://github.com/darkzoul5/YoutubePlaylistSync.git synced 2026-07-03 04:23:59 +03:00

Refactor import handling in integration test to simplify sys.path management

This commit is contained in:
2026-03-18 19:56:07 +02:00
parent e3559118c1
commit 46a31fa0f7
+5 -8
View File
@@ -12,18 +12,15 @@ import shutil
import time
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.
# Ensure the repository root and this tests folder are on sys.path so the script can import
# both the package (`src`) and local test helpers (`tests.temp_config`).
# Ensure the repository root is on sys.path so the script can import `src`.
REPO_ROOT = Path(__file__).resolve().parents[1]
TESTS_DIR = Path(__file__).resolve().parent
if str(REPO_ROOT) not in sys.path:
sys.path.insert(0, str(REPO_ROOT))
if str(TESTS_DIR) not in sys.path:
sys.path.insert(0, str(TESTS_DIR))
#import from src and tests
from src.downloader import PlaylistDownloader
from tests.dummy_config import DummyConfig
if not os.getenv("INTEGRATION_TEST"):
print("Skipping full integration test (set INTEGRATION_TEST=1 to enable)")