- 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.
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def test_launcher_files_exist():
|
|
for name in ("gpu-rent.bat", "gpu-rent.ps1", "gpu-rent.sh"):
|
|
path = ROOT / name
|
|
assert path.is_file(), name
|
|
text = path.read_text(encoding="utf-8")
|
|
assert ".venv" in text or "gpu-rent.ps1" in text
|
|
assert "gpu_rent" in text or "gpu-rent.ps1" in text
|
|
|
|
|
|
def test_launchers_require_python_311():
|
|
ps1 = (ROOT / "gpu-rent.ps1").read_text(encoding="utf-8")
|
|
sh = (ROOT / "gpu-rent.sh").read_text(encoding="utf-8")
|
|
assert "3, 11" in ps1 or "3.11" in ps1
|
|
assert "3, 11" in sh
|
|
|
|
|
|
def test_launchers_seed_project_local_files():
|
|
ps1 = (ROOT / "gpu-rent.ps1").read_text(encoding="utf-8")
|
|
sh = (ROOT / "gpu-rent.sh").read_text(encoding="utf-8")
|
|
assert 'Join-Path $env:USERPROFILE ".gpu-rent"' not in ps1
|
|
assert "${HOME}/.gpu-rent" not in sh
|
|
assert "models.yaml" in ps1 and "models.yaml" in sh
|
|
assert "extensions.yaml" in ps1 and "extensions.yaml" in sh
|
|
assert 'Join-Path $Root ".env"' in ps1
|
|
assert "$ROOT/.env" in sh
|