- Updated version number in pyproject.toml and __init__.py to 0.2.0. - Revised README.md to reflect the current state of the project, including usage instructions and setup steps. - Improved CLI documentation in cli.md, adding details about new commands and their functionalities. - Enhanced the quick start section in README.md for better clarity on initial setup. - Updated local folder documentation to clarify file handling and commands. - Added a new command for listing GPU flavors and improved error handling in the CLI. - Implemented a watchdog feature in the tunnel to manage server states effectively.
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
from gpu_rent.config import load_config
|
|
from gpu_rent.inventory import FlavorInfo
|
|
from gpu_rent.ux import cost_and_risk_lines, format_flavor_lines
|
|
|
|
|
|
def test_format_flavor_lines_marks_pick():
|
|
ranked = [
|
|
FlavorInfo("a", "RTX 4090 24GB", 8, 32768, False, {}, "4090-24"),
|
|
FlavorInfo("b", "A5000", 8, 32768, False, {}, "a5000"),
|
|
]
|
|
picked = ranked[0]
|
|
text = "\n".join(format_flavor_lines(ranked, picked))
|
|
assert "выберем" in text
|
|
assert "4090-24" in text
|
|
|
|
|
|
def test_cost_lines_mention_disk_and_killer(monkeypatch, tmp_path):
|
|
monkeypatch.setenv("HOME", str(tmp_path))
|
|
monkeypatch.setenv("USERPROFILE", str(tmp_path))
|
|
monkeypatch.chdir(tmp_path)
|
|
for key in (
|
|
"OS_AUTH_URL",
|
|
"OS_USER_DOMAIN_NAME",
|
|
"OS_USERNAME",
|
|
"OS_PASSWORD",
|
|
"OS_PROJECT_ID",
|
|
"OS_REGION_NAME",
|
|
"GPU_RENT_AZ",
|
|
):
|
|
monkeypatch.delenv(key, raising=False)
|
|
cfg = load_config(require_auth=False)
|
|
lines = cost_and_risk_lines(cfg, spot=True, flavor_name="GPU 4090")
|
|
blob = "\n".join(lines)
|
|
assert "24/7" in blob
|
|
assert "idle-killer" in blob
|
|
assert "панель" in blob.lower() or "Selectel" in blob
|