From 71b8b63037f3cc9f24fbab4c2c09ff117bdb2847 Mon Sep 17 00:00:00 2001 From: imSp4rky Date: Tue, 1 Dec 2026 11:44:19 -0700 Subject: [PATCH] test: leave the process and signal tests out of CI and reset the worker prompt handler --- .github/workflows/ci.yml | 2 +- pyproject.toml | 1 + tests/conftest.py | 9 ++++++++- tests/remote/unit/test_process_exit.py | 2 +- tests/remote/unit/test_relay_stop.py | 2 +- tests/remote/unit/test_run_cancel.py | 2 +- tests/remote/unit/test_serve_stop.py | 2 +- 7 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ddbd5590..27f48801 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,7 +81,7 @@ jobs: esac ffprobe -version | head -1 - name: Tests - run: uv run pytest -n auto --dist worksteal -m "not live and not slow" ${{ matrix.coverage && '--cov --cov-report=term --cov-report=html' || '' }} + run: uv run pytest -n auto --dist worksteal -m "not live and not slow and not process" ${{ matrix.coverage && '--cov --cov-report=term --cov-report=html' || '' }} - name: Upload coverage report if: ${{ matrix.coverage && !cancelled() }} uses: actions/upload-artifact@v7 diff --git a/pyproject.toml b/pyproject.toml index 1a1ddc4c..41351565 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -109,6 +109,7 @@ markers = [ "unit: fast, mocked tests (default)", "live: end-to-end tests against a running serve (opt-in via --live)", "slow: tests that hit real services and may take >10s", + "process: tests that start processes and time their signals or terminals (CI leaves them out)", ] filterwarnings = [ "ignore::DeprecationWarning:click.*", diff --git a/tests/conftest.py b/tests/conftest.py index 3a834dde..9fb9fc19 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -11,7 +11,7 @@ from typing import Any import pytest -from unshackle.core import binaries, process_exit +from unshackle.core import binaries, console, process_exit from unshackle.core import session as http_session from unshackle.core.config import config from unshackle.core.constants import RunCancel @@ -69,6 +69,13 @@ def keep_signal_handlers(monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.setattr(process_exit, "ends", set()) +@pytest.fixture(autouse=True) +def no_worker_handlers(monkeypatch: pytest.MonkeyPatch) -> None: + """Keep the prompt and notice relay of a job worker out of the next test, whose prompt then waits for an answer.""" + monkeypatch.setattr(console, "_prompt_handler", None) + monkeypatch.setattr(console, "_notice_handler", None) + + @pytest.fixture(autouse=True) def fresh_proxy_catalogues() -> None: """Fetch each proxy provider catalogue again, so one test's stub never answers another test.""" diff --git a/tests/remote/unit/test_process_exit.py b/tests/remote/unit/test_process_exit.py index b75b2c8b..166ec9aa 100644 --- a/tests/remote/unit/test_process_exit.py +++ b/tests/remote/unit/test_process_exit.py @@ -39,7 +39,7 @@ from unshackle.core.config import config from unshackle.core.remote_protocol import SESSION_CREATE_ROUTE, SESSION_ROUTE from unshackle.core.remote_service import RemoteError -pytestmark = pytest.mark.unit +pytestmark = [pytest.mark.unit, pytest.mark.process] posix = pytest.mark.skipif(sys.platform == "win32", reason="POSIX signals") SIGNALS = ["CTRL_BREAK_EVENT"] if sys.platform == "win32" else ["SIGHUP", "SIGTERM"] diff --git a/tests/remote/unit/test_relay_stop.py b/tests/remote/unit/test_relay_stop.py index 05f1a423..facb0d65 100644 --- a/tests/remote/unit/test_relay_stop.py +++ b/tests/remote/unit/test_relay_stop.py @@ -43,7 +43,7 @@ from unshackle.core.remote_protocol import ( APIErrorCode, ) -pytestmark = pytest.mark.unit +pytestmark = [pytest.mark.unit, pytest.mark.process] RELAY = """ import asyncio, json, sys diff --git a/tests/remote/unit/test_run_cancel.py b/tests/remote/unit/test_run_cancel.py index 920ceb8a..c5078ad4 100644 --- a/tests/remote/unit/test_run_cancel.py +++ b/tests/remote/unit/test_run_cancel.py @@ -52,7 +52,7 @@ from unshackle.core.remote_protocol import ( ) from unshackle.core.tracks import Audio, Tracks -pytestmark = [pytest.mark.unit, posix] +pytestmark = [pytest.mark.unit, pytest.mark.process, posix] BOUND = 8.0 WAITING = "Waiting for the remote server" diff --git a/tests/remote/unit/test_serve_stop.py b/tests/remote/unit/test_serve_stop.py index 5999d982..fefb79b1 100644 --- a/tests/remote/unit/test_serve_stop.py +++ b/tests/remote/unit/test_serve_stop.py @@ -50,7 +50,7 @@ from unshackle.core.remote_protocol import ( AuthStatus, ) -pytestmark = pytest.mark.unit +pytestmark = [pytest.mark.unit, pytest.mark.process] SERVES = { "api-only": ["--api-only", "--remote-only"],