Files
ingo fccd2def59 1) Uses textuals CSS_PATH and an external tcss file to bundle all DEFAULT_CSS into one file
2) Added keyboard shortcut bindings for switching the language (Ctrl-T) and showing the help (Ctrl-A) The help should use a markdown viewer
3) Include a test folder containing all the tests
2026-09-19 14:28:40 +02:00

47 lines
1.3 KiB
Python

"""Shared pytest fixtures for the yt-dlp download manager tests."""
from __future__ import annotations
import json
import sys
from pathlib import Path
import pytest
PROJECT_ROOT = Path(__file__).resolve().parent.parent
FIXTURES_DIR = Path(__file__).resolve().parent / "fixtures"
# Make both the app package and the bundled i18n library importable, exactly
# as main.py does for the real application.
sys.path.insert(0, str(PROJECT_ROOT / "lib"))
sys.path.insert(0, str(PROJECT_ROOT))
from i18n import I18n # noqa: E402
@pytest.fixture(scope="session", autouse=True)
def i18n_singleton() -> I18n:
"""Configure the process-wide I18n singleton once for the whole run.
Mirrors what main.py does before starting the real application.
"""
return I18n(
default_language="en",
available_languages={"en": "English", "de": "Deutsch"},
project_root=PROJECT_ROOT,
)
@pytest.fixture
def split_format_json() -> dict:
"""The "separate audio/video parts" example from the requirements doc."""
with (FIXTURES_DIR / "example_split.json").open(encoding="utf-8") as fh:
return json.load(fh)
@pytest.fixture
def combined_format_json() -> dict:
"""The "audio+video in one part" example from the requirements doc."""
with (FIXTURES_DIR / "example_combined.json").open(encoding="utf-8") as fh:
return json.load(fh)