mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-21 04:54:17 +02:00
Use SelectorEventLoop on Windows to fix pytest crashes
Windows ProactorEventLoop has known memory corruption issues that cause pytest-xdist worker crashes with "node down: Not properly terminated". Setting WindowsSelectorEventLoopPolicy in conftest.py avoids this issue. See: https://github.com/python/cpython/issues/116773 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
53efaeba5b
commit
bcd2e594f0
1 changed files with 7 additions and 0 deletions
|
|
@ -1,4 +1,6 @@
|
||||||
|
import asyncio
|
||||||
import socket
|
import socket
|
||||||
|
import sys
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
@ -7,6 +9,11 @@ import pytest
|
||||||
|
|
||||||
from fastmcp.utilities.tests import temporary_settings
|
from 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())
|
||||||
|
|
||||||
|
|
||||||
def pytest_collection_modifyitems(items):
|
def pytest_collection_modifyitems(items):
|
||||||
"""Automatically mark tests in integration_tests folder with 'integration' marker."""
|
"""Automatically mark tests in integration_tests folder with 'integration' marker."""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue