ci: ASYNC220 ignore follows Popen to run_shutdown.py; windows-only tests patch the defining module; whatsapp taskkill kwargs explicit

This commit is contained in:
Teknium
2026-09-03 05:12:25 -07:00
parent d38bb1b3aa
commit 5dcd3b2620
3 changed files with 7 additions and 3 deletions

View File

@@ -140,7 +140,10 @@ def _terminate_bridge_process(proc, *, force: bool = False) -> None:
action = "kill" if force else "terminate"
if _IS_WINDOWS:
try:
result = subprocess.run(["taskkill", "/PID", str(proc.pid), "/T"] + (["/F"] if force else []), timeout=10, **_RUN_TEXT)
result = subprocess.run(
["taskkill", "/PID", str(proc.pid), "/T"] + (["/F"] if force else []),
capture_output=True, text=True, encoding='utf-8', errors='replace', timeout=10,
)
except FileNotFoundError:
return getattr(proc, action)()
if result.returncode != 0:

View File

@@ -668,6 +668,7 @@ select = ["PLW1514", "ASYNC210", "ASYNC220", "ASYNC221", "ASYNC251"]
# process (no wait), an accepted momentary spawn cost pending a dedicated
# async-subprocess sweep.
"gateway/run.py" = ["ASYNC220"]
"gateway/run_shutdown.py" = ["ASYNC220"]
"gateway/slash_commands.py" = ["ASYNC220"]
# Off-loop sweep for these routers is in flight (PR #84376).
"hermes_cli/web_routers/profiles.py" = ["ASYNC220", "ASYNC221"]

View File

@@ -317,7 +317,7 @@ class TestWindowsMsysPathResolution:
"""Windows-only: ``_resolve_path_for_task`` hands the translated path
to ``ntpath``/``Path``, and only a real Windows ``Path`` renders
``C:\\Users\\...`` — faking ``sys.platform`` left PosixPath in place."""
import tools.file_tools as file_tools
import tools.file_tools_paths as file_tools
monkeypatch.setattr(file_tools, "_uses_container_paths", lambda task_id="default": False)
@@ -332,7 +332,7 @@ class TestWindowsMsysPathResolution:
Windows-only: the translation this guards against only happens when
the host really is Windows, so the negative is only meaningful there.
"""
import tools.file_tools as file_tools
import tools.file_tools_paths as file_tools
monkeypatch.setattr(file_tools, "_uses_container_paths", lambda task_id="default": True)
monkeypatch.setattr(