Skip to content

The agent that grows with you

test(bot-mode): skip the turn-lock module on Windows instead of aborting collection

hotragn96ca33d8a483
diff --git a/tests/tools/test_bot_turn_lock.py b/tests/tools/test_bot_turn_lock.py
index bc7ab7d50a6..797480c9854 100644
--- a/tests/tools/test_bot_turn_lock.py
+++ b/tests/tools/test_bot_turn_lock.py
@@ -9,16 +9,27 @@ process, so threads exercise the true kernel-lock semantics.
from __future__ import annotations
-import fcntl
import json
import os
import re
import subprocess
+import sys
import threading
import time
import pytest
+# `fcntl` does not exist on Windows, and an unguarded module-level import here
+# aborts collection for the whole `tests/tools/` directory rather than skipping
+# this one file. Skip before importing it, matching
+# `tests/cli/test_termios_drift_heal.py`. There is nothing to run here anyway:
+# `acquire_turn_lock()` degrades to a no-op contextmanager on Windows (no
+# `fcntl`), so the contention this module asserts on cannot occur.
+if sys.platform == "win32": # pragma: no cover
+ pytest.skip("bot turn lock contention is POSIX flock-only", allow_module_level=True)
+
+import fcntl
+
from tools import bot_mode_dm, bot_relay
from tools.bot_relay import TurnBusyError, acquire_turn_lock, turn_lock_path