mirror of
https://github.com/Dinnerbone/mcstatus.git
synced 2026-04-06 03:51:23 +08:00
Run formatter
This commit is contained in:
@@ -13,11 +13,14 @@ class FakeAsyncStream(asyncio.StreamReader):
|
|||||||
return bytes([0] * n)
|
return bytes([0] * n)
|
||||||
|
|
||||||
|
|
||||||
def fake_asyncio_asyncio_open_connection(hostname, port):
|
async def fake_asyncio_asyncio_open_connection(hostname, port):
|
||||||
return FakeAsyncStream(), None
|
return FakeAsyncStream(), None
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.platform.startswith("win"), reason="async bug on Windows https://github.com/Dinnerbone/mcstatus/issues/140")
|
@pytest.mark.skipif(
|
||||||
|
sys.platform.startswith("win"),
|
||||||
|
reason="async bug on Windows https://github.com/Dinnerbone/mcstatus/issues/140",
|
||||||
|
)
|
||||||
class TestAsyncSocketConnection:
|
class TestAsyncSocketConnection:
|
||||||
def setup_method(self):
|
def setup_method(self):
|
||||||
self.tcp_async_socket = TCPAsyncSocketConnection()
|
self.tcp_async_socket = TCPAsyncSocketConnection()
|
||||||
@@ -29,8 +32,7 @@ class TestAsyncSocketConnection:
|
|||||||
from asyncio import TimeoutError
|
from asyncio import TimeoutError
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
with patch("asyncio.open_connection") as open_conn:
|
with patch("asyncio.open_connection", fake_asyncio_asyncio_open_connection) as open_conn:
|
||||||
open_conn.return_value = (FakeAsyncStream(), None)
|
|
||||||
loop.run_until_complete(self.tcp_async_socket.connect("dummy_address", timeout=0.01))
|
loop.run_until_complete(self.tcp_async_socket.connect("dummy_address", timeout=0.01))
|
||||||
|
|
||||||
with pytest.raises(TimeoutError):
|
with pytest.raises(TimeoutError):
|
||||||
|
|||||||
Reference in New Issue
Block a user