Files
gpu-rent/tests/conftest.py
T
Leonid Pershin 343f741baa Refactor environment and configuration management
- Updated the project structure to store configuration files (.env, models.yaml, extensions.yaml) in the project root instead of the user's home directory.
- Enhanced the setup process to automatically copy example files to the project root on first run.
- Implemented a migration function to transfer legacy configuration files from the user's home directory to the new project structure.
- Revised documentation to reflect changes in file locations and setup instructions.
- Improved code readability and maintainability by refactoring path management functions.
2026-08-21 03:20:18 +03:00

26 lines
599 B
Python

"""Keep tests from picking up a real project .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