Spaces:
Running
Running
Jeremiah Lowin commited on
Commit ·
307fe1e
1
Parent(s): a7c6f7e
Skip timeout tests on windows
Browse files
tests/client/test_client.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import asyncio
|
|
|
|
| 2 |
from typing import cast
|
| 3 |
|
| 4 |
import pytest
|
|
@@ -509,6 +510,10 @@ class TestErrorHandling:
|
|
| 509 |
assert "This is a resource error (xyz)" in str(excinfo.value)
|
| 510 |
|
| 511 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 512 |
class TestTimeout:
|
| 513 |
async def test_timeout(self, fastmcp_server: FastMCP):
|
| 514 |
async with Client(
|
|
|
|
| 1 |
import asyncio
|
| 2 |
+
import sys
|
| 3 |
from typing import cast
|
| 4 |
|
| 5 |
import pytest
|
|
|
|
| 510 |
assert "This is a resource error (xyz)" in str(excinfo.value)
|
| 511 |
|
| 512 |
|
| 513 |
+
@pytest.mark.skipif(
|
| 514 |
+
sys.platform == "win32",
|
| 515 |
+
reason="Timeout tests are flaky on Windows. Timeouts *are* supported but the tests are unreliable.",
|
| 516 |
+
)
|
| 517 |
class TestTimeout:
|
| 518 |
async def test_timeout(self, fastmcp_server: FastMCP):
|
| 519 |
async with Client(
|
tests/client/test_sse.py
CHANGED
|
@@ -136,11 +136,11 @@ async def test_nested_sse_server_resolves_correctly():
|
|
| 136 |
assert result is True
|
| 137 |
|
| 138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
class TestTimeout:
|
| 140 |
-
@pytest.mark.skipif(
|
| 141 |
-
sys.platform == "win32",
|
| 142 |
-
reason="This test is flaky on Windows. Sometimes the client timeout is respected and sometimes it is not.",
|
| 143 |
-
)
|
| 144 |
async def test_timeout(self, sse_server: str):
|
| 145 |
with pytest.raises(
|
| 146 |
McpError,
|
|
@@ -167,10 +167,6 @@ class TestTimeout:
|
|
| 167 |
with pytest.raises(McpError, match="Timed out"):
|
| 168 |
await client.call_tool("sleep", {"seconds": 0.1}, timeout=0.01)
|
| 169 |
|
| 170 |
-
@pytest.mark.skipif(
|
| 171 |
-
sys.platform == "win32",
|
| 172 |
-
reason="This test is flaky on Windows. Sometimes the client timeout is respected and sometimes it is not.",
|
| 173 |
-
)
|
| 174 |
async def test_timeout_client_timeout_does_not_override_tool_call_timeout_if_lower(
|
| 175 |
self, sse_server: str
|
| 176 |
):
|
|
|
|
| 136 |
assert result is True
|
| 137 |
|
| 138 |
|
| 139 |
+
@pytest.mark.skipif(
|
| 140 |
+
sys.platform == "win32",
|
| 141 |
+
reason="Timeout tests are flaky on Windows. Timeouts *are* supported but the tests are unreliable.",
|
| 142 |
+
)
|
| 143 |
class TestTimeout:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
async def test_timeout(self, sse_server: str):
|
| 145 |
with pytest.raises(
|
| 146 |
McpError,
|
|
|
|
| 167 |
with pytest.raises(McpError, match="Timed out"):
|
| 168 |
await client.call_tool("sleep", {"seconds": 0.1}, timeout=0.01)
|
| 169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
async def test_timeout_client_timeout_does_not_override_tool_call_timeout_if_lower(
|
| 171 |
self, sse_server: str
|
| 172 |
):
|
tests/client/test_streamable_http.py
CHANGED
|
@@ -149,6 +149,10 @@ async def test_nested_streamable_http_server_resolves_correctly():
|
|
| 149 |
assert result is True
|
| 150 |
|
| 151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
class TestTimeout:
|
| 153 |
async def test_timeout(self, streamable_http_server: str):
|
| 154 |
# note this transport behaves differently than others and raises
|
|
|
|
| 149 |
assert result is True
|
| 150 |
|
| 151 |
|
| 152 |
+
@pytest.mark.skipif(
|
| 153 |
+
sys.platform == "win32",
|
| 154 |
+
reason="Timeout tests are flaky on Windows. Timeouts *are* supported but the tests are unreliable.",
|
| 155 |
+
)
|
| 156 |
class TestTimeout:
|
| 157 |
async def test_timeout(self, streamable_http_server: str):
|
| 158 |
# note this transport behaves differently than others and raises
|