"""Keep tests from picking up a real ~/.gpu-rent/.env or OS_* from the shell.""" import pytest OS_KEYS = ( "OS_AUTH_URL", "OS_USER_DOMAIN_NAME", "OS_USERNAME", "OS_PASSWORD", "OS_PROJECT_ID", "OS_REGION_NAME", "GPU_RENT_AZ", "CIVITAI_API_TOKEN", ) @pytest.fixture(autouse=True) def isolate_home(tmp_path, monkeypatch): monkeypatch.setenv("HOME", str(tmp_path)) monkeypatch.setenv("USERPROFILE", str(tmp_path)) monkeypatch.chdir(tmp_path) for key in OS_KEYS: monkeypatch.delenv(key, raising=False) return tmp_path