runbook-tutorials/tests/conftest.py

10 lines
368 B
Python
Raw Normal View History

import pytest
@pytest.fixture(autouse=True)
def _isolated_user(tmp_path_factory, monkeypatch):
"""Tests never read or write the real user's app settings."""
monkeypatch.setenv("RTUT_CONFIG_DIR", str(tmp_path_factory.mktemp("rtut-config")))
monkeypatch.delenv("RTUT_USER", raising=False)
monkeypatch.setattr("getpass.getuser", lambda: "tester-login")