diff --git a/mcstatus/tests/test_timeout.py b/mcstatus/tests/test_timeout.py index d95f36e..1c1b50e 100644 --- a/mcstatus/tests/test_timeout.py +++ b/mcstatus/tests/test_timeout.py @@ -1,13 +1,13 @@ -import asyncio -from asyncio import StreamReader +from mock import patch +import sys +import asyncio import pytest -from mock import patch from mcstatus.protocol.connection import TCPAsyncSocketConnection -class FakeAsyncStream(StreamReader): +class FakeAsyncStream(asyncio.StreamReader): async def read(self, n: int) -> bytes: await asyncio.sleep(delay=2) return bytes([0] * n) @@ -17,6 +17,7 @@ def fake_asyncio_asyncio_open_connection(hostname, port): return FakeAsyncStream(), None +@pytest.mark.skipif(sys.platform.startswith("win"), reason="async bug on Windows https://github.com/Dinnerbone/mcstatus/issues/140") class TestAsyncSocketConnection: def setup_method(self): self.tcp_async_socket = TCPAsyncSocketConnection() diff --git a/tox.ini b/tox.ini index dfedef0..5bc1212 100644 --- a/tox.ini +++ b/tox.ini @@ -11,6 +11,7 @@ commands = pytest {posargs} [testenv:check] +platform = linux2|darwin commands = black --check -l 127 ./mcstatus pytype ./mcstatus