mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-10 21:47:02 +01:00
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (mypy, mypy) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (pylint, pylint) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (rest, ) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (shellcheck, shellcheck) (push) Waiting to run
Python tests / test (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Shell tests / shell-tests (push) Waiting to run
Shell tests / lib-tests (push) Waiting to run
Shell tests / arch-tests (push) Waiting to run
The CUPS-fallback note blamed a missing pyusb when the probe was really skipped because CUPS owned the printer. It now names the real reason. run.sh installs python-pyusb for the system python3 that sudo runs. A paper misfeed blocks the usb:// backend while CUPS keeps saying "processing", and cancel leaves that backend hung so the queue never recovers. The report now flags a job whose page counter is frozen for 15 s, and a backend of a cancelled job, with a y/N offer to SIGKILL it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaBRWtXXWCs3K3yPHSruUC
26 lines
929 B
Python
26 lines
929 B
Python
"""Tests for cups_service._usb_probe_skip_reason - the fallback note's reason."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from unittest.mock import MagicMock, patch
|
|
|
|
from python_pkg.brother_printer.cups_service import _usb_probe_skip_reason
|
|
|
|
MOD = "python_pkg.brother_printer.cups_service"
|
|
|
|
|
|
class TestUsbProbeSkipReason:
|
|
"""The note must name the real reason, not blame a pyusb that is there."""
|
|
|
|
def test_busy_cups_wins(self) -> None:
|
|
reason = _usb_probe_skip_reason("processing")
|
|
assert "CUPS has a job" in reason
|
|
|
|
@patch(f"{MOD}._import_or_raise", side_effect=ImportError("usb.core"))
|
|
def test_pyusb_missing(self, m: MagicMock) -> None:
|
|
assert "pyusb not installed" in _usb_probe_skip_reason("idle")
|
|
|
|
@patch(f"{MOD}._import_or_raise", return_value=MagicMock())
|
|
def test_printer_silent(self, m: MagicMock) -> None:
|
|
assert "did not answer" in _usb_probe_skip_reason("idle")
|