Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

test: run Windows tests without xdist parallelism

Chris Guidrycf101c2a8268
diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
index a3fb99999..f4a7c847a 100644
--- a/.github/workflows/run-tests.yml
+++ b/.github/workflows/run-tests.yml
@@ -48,7 +48,13 @@ jobs:
run: uv sync --upgrade
- name: Run tests (excluding integration and client_process)
- run: uv run pytest --inline-snapshot=disable tests -m "not integration and not client_process" --numprocesses auto --maxprocesses 4 --dist worksteal
+ run: |
+ if [ "$RUNNER_OS" == "Windows" ]; then
+ # Run without parallelism on Windows to debug xdist crashes
+ uv run pytest --inline-snapshot=disable tests -m "not integration and not client_process"
+ else
+ uv run pytest --inline-snapshot=disable tests -m "not integration and not client_process" --numprocesses auto --maxprocesses 4 --dist worksteal
+ fi
shell: bash
- name: Run client process tests separately
diff --git a/tests/conftest.py b/tests/conftest.py
index 3f9b10129..22487f97e 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,51 +1,13 @@
-import asyncio
import socket
from collections.abc import Callable
from pathlib import Path
from typing import Any
-from unittest.mock import patch
import pytest
from fastmcp.utilities.tests import temporary_settings
-# 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()
-
-
[email protected](autouse=True)
-def fresh_fakeredis_server():
- """Give each test a fresh FakeServer instead of sharing one.
-
- Docket stores a shared FakeServer as a class attribute (_memory_server).
- This can cause issues when many tests run in parallel on Windows.
- Reset it before each test to ensure isolation.
- """
- from docket import Docket
-
- # Clear the shared server so each test gets a fresh one
- if hasattr(Docket, "_memory_server"):
- delattr(Docket, "_memory_server")
-
- yield
-
- # Clean up after test
- if hasattr(Docket, "_memory_server"):
- delattr(Docket, "_memory_server")
-
-
def pytest_collection_modifyitems(items):
"""Automatically mark tests in integration_tests folder with 'integration' marker."""
for item in items: