whisper-dictation/tests/test_installer.py

25 lines
959 B
Python

import sys
import os
def test_autostart_roundtrip(tmp_path, monkeypatch):
"""install then remove leaves no trace."""
import whisper_app.installer as inst
monkeypatch.setattr(sys, "frozen", True, raising=False)
monkeypatch.setattr(sys, "executable", str(tmp_path / "wd.exe"))
if sys.platform == "win32":
# On Windows, test registry-based autostart
import winreg
_REG_KEY = r"Software\Microsoft\Windows\CurrentVersion\Run"
inst.install_autostart()
assert inst.autostart_installed()
inst.remove_autostart()
assert not inst.autostart_installed()
else:
monkeypatch.setattr(inst, "_autostart_path",
lambda: str(tmp_path / ".config/autostart/whisper-dictation.desktop"))
inst.install_autostart()
assert inst.autostart_installed()
inst.remove_autostart()
assert not inst.autostart_installed()