3e779be6f3
CI / lint (push) Failing after 13m4s
CI / test (3.11, ubuntu-latest) (push) Failing after 2m4s
CI / test (3.13, ubuntu-latest) (push) Successful in 13m30s
CI / test (3.14, ubuntu-latest) (push) Successful in 17m21s
CI / test (3.12, ubuntu-latest) (push) Successful in 17m55s
CI / discover-apps-ps (push) Successful in 1m56s
CI / test (3.9, ubuntu-latest) (push) Successful in 13m17s
CI / test (3.10, ubuntu-latest) (push) Successful in 26m21s
CI / audit (push) Successful in 13m38s
Deploy site / deploy (push) Has been cancelled
CI / test (3.14, ubuntu-24.04-arm) (push) Has been cancelled
31 lines
1016 B
Python
31 lines
1016 B
Python
# SPDX-License-Identifier: MIT
|
|
"""Shared pytest configuration and autouse fixtures."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def _isolate_xdg_and_home(
|
|
monkeypatch: pytest.MonkeyPatch,
|
|
tmp_path_factory: pytest.TempPathFactory,
|
|
):
|
|
"""Redirect XDG_* and HOME to an isolated per-test directory."""
|
|
root = tmp_path_factory.mktemp("winpodx_xdg")
|
|
home = root / "home"
|
|
config = root / "xdg_config"
|
|
data = root / "xdg_data"
|
|
cache = root / "xdg_cache"
|
|
state = root / "xdg_state"
|
|
runtime = root / "xdg_runtime"
|
|
for directory in (home, config, data, cache, state, runtime):
|
|
directory.mkdir(parents=True, exist_ok=True)
|
|
|
|
monkeypatch.setenv("HOME", str(home))
|
|
monkeypatch.setenv("XDG_CONFIG_HOME", str(config))
|
|
monkeypatch.setenv("XDG_DATA_HOME", str(data))
|
|
monkeypatch.setenv("XDG_CACHE_HOME", str(cache))
|
|
monkeypatch.setenv("XDG_STATE_HOME", str(state))
|
|
monkeypatch.setenv("XDG_RUNTIME_DIR", str(runtime))
|