29 lines
677 B
Python
29 lines
677 B
Python
"""
|
|
Konfigurace pytest - sdílené fixtures a nastavení pro všechny testy
|
|
"""
|
|
import pytest
|
|
import tempfile
|
|
import shutil
|
|
from pathlib import Path
|
|
|
|
|
|
@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():
|
|
try:
|
|
config_file.unlink()
|
|
except Exception:
|
|
pass
|