Files
VoiceStudio/tests/test_sonitranslate_venv.py
T
Palash DebnathandClaude Opus 4.8 8098e7537e fix(win): SoniTranslate venv paths cross-platform — Scripts/ on Windows (#186) (#188)
sonitranslate.py hardcoded SONI_VENV/'bin'/{pip,python} (POSIX). On Windows,
python -m venv creates Scripts\ with .exe, so is_venv_ready() was always False
(install looped) and start() fell back to the wrong interpreter -> 30s timeout.

- Add _venv_bin(name): Scripts/{name}.exe on win32 else bin/{name} (mirrors
  engines/indextts/bootstrap.py). Use it for the is_venv_ready/install/start
  pip+python paths.
- stop(): _proc.terminate() instead of send_signal(SIGTERM) (cross-platform);
  drop the now-unused signal import.
- test: _venv_bin returns Scripts/pip.exe on win32, bin/python on posix.

Closes #186.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-31 03:38:54 +05:30

17 lines
485 B
Python

"""SoniTranslate venv binary paths must be cross-platform (#186)."""
from services import sonitranslate as s
def test_venv_bin_windows(monkeypatch):
monkeypatch.setattr(s.sys, "platform", "win32")
p = s._venv_bin("pip")
assert p.name == "pip.exe"
assert p.parent.name == "Scripts"
def test_venv_bin_posix(monkeypatch):
monkeypatch.setattr(s.sys, "platform", "linux")
p = s._venv_bin("python")
assert p.name == "python"
assert p.parent.name == "bin"