mirror of
https://github.com/rr-/pq-cli.git
synced 2026-11-12 22:40:36 -07:00
The roster tests pin down the .old backup rotation and the five minute periodic save, with a fake clock in place of datetime. The command line tests call main() in-process with the save and data paths in a temporary directory, so coverage counts them. They cover listing, loading, importing and exporting saves, dumping and loading word lists, and the first-run character creation. The curses UI is swapped for a stub there so a stray code path fails instead of taking over the terminal. --load-save 0 falls through to the menu and --load-save -1 plays the last character instead of being rejected; both are marked xfail. A shared fixture restores pytest's SIGINT handler after the UIs install their own.
17 lines
388 B
Python
17 lines
388 B
Python
import signal
|
|
import sys
|
|
from collections.abc import Iterator
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
sys.path.insert(0, str(Path(__file__).parent))
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def _restore_sigint() -> Iterator[None]:
|
|
"""The UIs install their own SIGINT handler; keep pytest's."""
|
|
handler = signal.getsignal(signal.SIGINT)
|
|
yield
|
|
signal.signal(signal.SIGINT, handler)
|