Files
Athena-Deck/deploy/applio-web/backend/tests/test_realtime.py
T
Mikei386 06cacafbad Add native Applio RVC and preserve the custom studio UI
Pin Applio 3.6.5 and verified basis assets, migrate private voice provenance, and coordinate conversion/live/training with Deck GPU leases. Prepare an inactive voice profile and a restricted studio container. Move CUDA and Torch caches out of the small temporary filesystem to prevent OmniVoice reference failures. Package app updates from the explicit allowlist in one Docker layer.
2026-10-05 10:02:07 +02:00

48 lines
1.6 KiB
Python

def test_realtime_defaults_are_low_latency():
from app.api.realtime import RealtimeInit
init = RealtimeInit(model_name="Anna")
assert init.f0_method == "fcpe"
assert init.chunk_ms == 120
assert init.context_seconds == 0.5
def test_build_applio_init_maps_model_paths(monkeypatch, tmp_dirs):
from app import config
from app.api import realtime
from app.services.models import ModelInfo
config._settings = None
monkeypatch.setenv("MODELS_DIR", str(tmp_dirs["models"]))
pth = tmp_dirs["models"] / "Anna" / "Anna.pth"
index = tmp_dirs["models"] / "Anna" / "Anna.index"
monkeypatch.setattr(
realtime,
"get_model",
lambda _name: ModelInfo(name="Anna", pth_path=str(pth), index_path=str(index)),
)
payload = realtime.build_applio_init(realtime.RealtimeInit(model_name="Anna"))
assert payload["model_path"] == "/app/logs/Anna/Anna.pth"
assert payload["index_path"] == "/app/logs/Anna/Anna.index"
assert payload["chunk_size"] == 45
assert payload["chunk_size"] * 128 == 5760
config._settings = None
def test_gpu_jobs_are_rejected_during_live_session(client):
client.app.state.realtime_active = True
response = client.post(
"/api/jobs/convert",
json={"model_name": "Anna", "input_path": "missing"},
)
assert response.status_code == 409
assert "Live-Umwandlung" in response.json()["detail"]
def test_realtime_status(client):
response = client.get("/api/realtime/status")
assert response.status_code == 200
assert response.json()["sample_rate"] == 48000
assert response.json()["single_session"] is True