Files
Curator/tests/conftest.py
T

30 lines
686 B
Python

"""
Konfigurace pytest - sdílené fixtures a nastavení pro všechny testy
"""
import contextlib
import shutil
import tempfile
from pathlib import Path
import pytest
@pytest.fixture(scope="session")
def session_temp_dir():
"""Session-wide dočasný adresář"""
temp_dir = Path(tempfile.mkdtemp())
yield temp_dir
shutil.rmtree(temp_dir, ignore_errors=True)
@pytest.fixture(autouse=True)
def cleanup_config_files():
"""Automaticky vyčistí config.json soubory po každém testu"""
yield
# Cleanup po testu
config_file = Path("config.json")
if config_file.exists():
with contextlib.suppress(Exception):
config_file.unlink()