ytdl-sub/tests/resources.py
2024-09-27 09:39:09 -07:00

20 lines
618 B
Python

import os
import shutil
from pathlib import Path
REGENERATE_FIXTURES: bool = False
RUN_E2E_DOWNLOAD_TESTS: bool = False
RESOURCE_PATH: Path = Path("tests") / "resources"
_FILE_FIXTURE_PATH: Path = RESOURCE_PATH / "file_fixtures"
E2E_DRY_RUN_FIXTURE_VALUE = [True, False] if RUN_E2E_DOWNLOAD_TESTS else [True]
def file_fixture_path(fixture_name: str) -> Path:
return _FILE_FIXTURE_PATH / fixture_name
def copy_file_fixture(fixture_name: str, output_file_path: Path) -> None:
os.makedirs(os.path.dirname(output_file_path), exist_ok=True)
shutil.copy(file_fixture_path(fixture_name), output_file_path)