π The fast, Pythonic way to build MCP servers and clients.
Disable Docket strike monitoring in tests (fakeredis busy-loop fix)
Chris Guidry55297a06a30e
diff --git a/tests/conftest.py b/tests/conftest.pyindex b45824a9e..2409ade70 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -1,18 +1,28 @@import asyncioimport socket-import sysfrom collections.abc import Callablefrom pathlib import Pathfrom typing import Any+from unittest.mock import patchimport pytestfrom fastmcp.utilities.tests import temporary_settings-# Use SelectorEventLoop on Windows to avoid ProactorEventLoop crashes-# See: https://github.com/python/cpython/issues/116773-if sys.platform == "win32":- asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())++# Fakeredis doesn't properly implement blocking xread - it returns immediately+# instead of waiting. This causes Docket._monitor_strikes to busy-loop, which+# overwhelms pytest-xdist workers on Windows. Replace with a simple sleep loop.+# See: https://github.com/cunla/fakeredis-py/issues/274+async def _mock_monitor_strikes(self):+ while True:+ await asyncio.sleep(60)+++_monitor_strikes_patch = patch(+ "docket.docket.Docket._monitor_strikes", _mock_monitor_strikes+)+_monitor_strikes_patch.start()def pytest_collection_modifyitems(items):