test: make the suite run under Windows

Windows spells a path with backslashes, and three fixtures took the POSIX shape: a config value written into a TOML basic string read `C:\users\…` as an escape, tool arguments built with an f-string broke the same way, and a root was compared as `str(path)` against `/srv/skills`. Paths are encoded with `json.dumps` (whose escaping is valid TOML and valid JSON) and compared as `Path` objects, so the same root matches in either spelling.

`test_interrupt.py` delivers SIGINT with `os.kill(pid, SIGINT)`, which is `TerminateProcess` on Windows, and the router itself needs `add_signal_handler`: the module is skipped there.

`python scripts/wine_pdm.py ci` is green: ruff, basedpyright 0 errors, 1156 passed / 30 skipped.
This commit is contained in:
2026-10-21 19:28:49 +08:00
parent 4c597274e7
commit aafbc207a3
4 changed files with 28 additions and 14 deletions
+9
View File
@@ -3,6 +3,7 @@ from __future__ import annotations
import asyncio
import os
import signal
import sys
import threading
import time
from typing import TYPE_CHECKING
@@ -35,6 +36,14 @@ if TYPE_CHECKING:
import pytest as pytest_module
# The router is asyncio's SIGINT handler, which only exists where signals do; on
# Windows a test could not deliver one either — ``os.kill(pid, SIGINT)`` is
# ``TerminateProcess`` there, so it kills the runner instead of interrupting it.
pytestmark = pytest.mark.skipif(
sys.platform == "win32",
reason="SIGINT routing needs POSIX signal handling",
)
class FakeTarget:
"""Minimal ``InterruptTarget`` recording its cancels."""