23 lines
660 B
Python
23 lines
660 B
Python
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from {{ cookiecutter.package_name }}.config import clear_config_cache
|
|
from {{ cookiecutter.package_name }}.config.paths import ENV_CONFIG_VAR
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def _isolate_xdg_paths(monkeypatch, tmp_path_factory) -> None:
|
|
temp_root = tmp_path_factory.mktemp("xdg")
|
|
monkeypatch.setenv("XDG_CONFIG_HOME", str(temp_root / "config"))
|
|
monkeypatch.setenv("XDG_DATA_HOME", str(temp_root / "data"))
|
|
monkeypatch.delenv(ENV_CONFIG_VAR, raising=False)
|
|
yield
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def _clear_config_cache() -> None:
|
|
clear_config_cache()
|
|
yield
|
|
clear_config_cache()
|