2026-08-31 21:05:24 +08:00

19 lines
491 B
Python

"""Shared pytest fixtures for deterministic test configuration."""
from pathlib import Path
import pytest
from ekp_core.config import Settings
@pytest.fixture
def isolated_settings_environment(
monkeypatch: pytest.MonkeyPatch,
tmp_path: Path,
) -> None:
"""Prevent developer environment variables or .env files from changing tests."""
monkeypatch.chdir(tmp_path)
for field_name in Settings.model_fields:
monkeypatch.delenv(field_name.upper(), raising=False)