From 1f975d1b8fa873565f435e0b86d9c067d346bc8f Mon Sep 17 00:00:00 2001 From: Volker Christian Date: Mon, 12 Oct 2026 11:49:44 +0200 Subject: [PATCH] test: correct cross-platform CI fixtures and name stalled tests --- pyproject.toml | 4 +++- tests/test_backend_progress.py | 1 + tests/test_screen_capture.py | 9 +++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2bd15c6..e8f8f2e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ dependencies = ["PySide6==6.11.2", "numpy==2.3.5", "av==18.1.0"] [project.optional-dependencies] -dev = ["pytest>=8,<10", "pytest-qt>=4.4,<5", "pyinstaller==6.22.3"] +dev = ["pytest>=8,<10", "pytest-qt>=4.4,<5", "pytest-timeout==2.4.0", "pyinstaller==6.22.3"] [project.scripts] autotalk = "autotalk.app:main" @@ -25,3 +25,5 @@ packages = ["src/autotalk"] [tool.pytest.ini_options] testpaths = ["tests"] markers = ["audio_device: requires an available physical or virtual system audio output"] +timeout = 300 +timeout_method = "thread" diff --git a/tests/test_backend_progress.py b/tests/test_backend_progress.py index 96367c1..4cf9915 100644 --- a/tests/test_backend_progress.py +++ b/tests/test_backend_progress.py @@ -85,6 +85,7 @@ def loading_worker(tmp_path, monkeypatch): monkeypatch.setattr(runtime, 'ensure_speech', lambda task: Path(sys.executable)) monkeypatch.setattr(runtime, 'worker_path', lambda: script) monkeypatch.setattr(runtime, 'speech_backend', lambda: 'vllm') + monkeypatch.setattr(services, 'speech_backend', lambda: 'vllm') return script diff --git a/tests/test_screen_capture.py b/tests/test_screen_capture.py index cbb347c..bea688c 100644 --- a/tests/test_screen_capture.py +++ b/tests/test_screen_capture.py @@ -111,9 +111,18 @@ def warning(*args): def test_closed_capture_releases_qt_objects_without_garbage_collection(qtbot, project, monkeypatch): import shiboken6 from PySide6.QtMultimedia import QScreenCapture + # Exercise real QObject cleanup, not unsupported native capture or hardware. + monkeypatch.setattr(screen_capture.sys, 'platform', 'linux') monkeypatch.setattr(QScreenCapture, 'start', lambda self: None) capture = screen_capture.ScreenCapture(project) objects = (capture.session, capture.screen, capture.sink) capture.close() qtbot.waitUntil(lambda: all(not shiboken6.isValid(obj) for obj in objects), timeout=1000) assert capture.stopping.is_set() + + +@pytest.mark.parametrize('platform', ['darwin', 'win32']) +def test_desktop_capture_rejects_unsupported_platform(project, monkeypatch, platform): + monkeypatch.setattr(screen_capture.sys, 'platform', platform) + with pytest.raises(RuntimeError, match='Desktop audio recording currently requires Linux'): + screen_capture.ScreenCapture(project)