"""Pytest config for the RELATION suite. On this Windows box the default pytest basetemp under %LOCALAPPDATA%\\Temp can hit a PermissionError; redirect tmp_path-based fixtures to a writable location under C:/tmp (the project's additional working directory) when the user has not already supplied --basetemp. This keeps `python -m pytest tests/` runnable with zero extra flags. """ from __future__ import annotations import os from pathlib import Path def pytest_configure(config) -> None: # Respect an explicitly-supplied --basetemp. if config.option.basetemp: return candidate = Path("C:/tmp/pytest_base") try: candidate.mkdir(parents=True, exist_ok=True) # Confirm it is writable before claiming it. probe = candidate / ".write_probe" probe.write_text("ok", encoding="utf-8") probe.unlink() except OSError: return config.option.basetemp = str(candidate) os.environ.setdefault("PYTEST_DEBUG_TEMPROOT", str(candidate))