Skip to content

Commit c3aac59

Browse files
chrisguidryclaude
andcommitted
Replace pytest-retry with pytest-rerunfailures for Windows stability
Windows CI was experiencing worker crashes due to ConnectionResetError in pytest-retry's internal server when running with pytest-xdist: ``` pytest_retry\server.py", line 45, in run_server chunk = conn.recv(4096) ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host ``` This crashed worker gw0, leaving orphaned temp directories with locked SQLite files, causing cascading teardown failures in caching tests. Even pytest-retry 1.7.0 (latest, with socket cleanup fixes) has unresolved race conditions in its server/client communication on Windows with xdist. **Solution**: Switch to pytest-rerunfailures, which has better pytest-xdist compatibility and is the officially recommended plugin by pytest-dev. **Changes**: - Replace `pytest-retry>=1.7.0` with `pytest-rerunfailures>=14.0` - Update flaky test markers: - `@pytest.mark.flaky(retries=N)` → `@pytest.mark.flaky(reruns=N)` - `delay=N` → `reruns_delay=N` - Updated 3 flaky tests: - `test_github_mcp_remote.py::TestGithubMCPRemote` (network tests) - `test_mcp_config.py::test_multi_client_transform_with_filtering` (subprocess timing) - `test_openapi_experimental.py::test_client_headers_proxy` (proxy test) pytest-rerunfailures is actively maintained by pytest-dev and explicitly documents compatibility with pytest-xdist, including support for rerunning tests when workers crash. Related: https://github.com/jlowin/fastmcp/actions/runs/19540316503/job/55944598449 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 65143fa commit c3aac59

5 files changed

Lines changed: 11 additions & 10 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ dev = [
7070
"pytest-flakefinder>=1.1.0",
7171
"pytest-httpx>=0.35.0",
7272
"pytest-report>=0.2.1",
73-
"pytest-retry>=1.7.0",
73+
"pytest-rerunfailures>=14.0",
7474
"pytest-timeout>=2.4.0",
7575
"pytest-xdist>=3.6.1",
7676
"ruff>=0.12.8",

tests/client/test_openapi_experimental.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ async def test_client_with_excluded_header_is_ignored(sse_server: str):
183183
assert headers["host"] == "fastapi"
184184

185185

186-
@pytest.mark.flaky(retries=2, delay=1)
186+
@pytest.mark.flaky(reruns=2, reruns_delay=1)
187187
async def test_client_headers_proxy(proxy_server: str):
188188
"""
189189
Test that client headers are passed through the proxy to the remove server.

tests/integration_tests/test_github_mcp_remote.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def fixture_streamable_http_client() -> Client[StreamableHttpTransport]:
3434
)
3535

3636

37-
@pytest.mark.flaky(retries=2, delay=1)
37+
@pytest.mark.flaky(reruns=2, reruns_delay=1)
3838
class TestGithubMCPRemote:
3939
async def test_connect_disconnect(
4040
self,

tests/test_mcp_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ def add(a: int, b: int) -> int:
639639
assert "test_1_transformed_add" not in tools_by_name
640640

641641

642-
@pytest.mark.flaky(retries=3)
642+
@pytest.mark.flaky(reruns=3)
643643
async def test_multi_client_transform_with_filtering(tmp_path: Path):
644644
"""
645645
Tests that tag-based filtering works when using a transforming MCPConfig.

uv.lock

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)