Skip to content

Commit

Permalink
fix(tests): Fix hanging tests
Browse files Browse the repository at this point in the history
There is a Python bug with .wait_closed(); just remove this invocation.

* python/cpython#104344
* python/cpython#109538
  • Loading branch information
rumpelsepp committed Dec 8, 2023
1 parent a3ed8ec commit 6271e56
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/test_transports.py
Expand Up @@ -38,9 +38,8 @@ async def listen(self, target: TargetURI) -> None:
async def accept(self) -> TCPTransport:
return await self.queue.get()

async def close(self) -> None:
def close(self) -> None:
self.server.close()
await self.server.wait_closed()


async def _echo_test(
Expand All @@ -66,7 +65,7 @@ async def tcp_server() -> AsyncIterator[TCPServer]:
tcp_server = TCPServer()
await tcp_server.listen(listen_target)
yield tcp_server
await tcp_server.close()
tcp_server.close()


@pytest.mark.asyncio
Expand Down Expand Up @@ -127,7 +126,7 @@ async def test_tcp_linesep_request(tcp_server: TCPServer) -> None:
@pytest.mark.asyncio
async def test_tcp_timeout(tcp_server: TCPServer) -> None:
client = await TCPLinesTransport.connect(TargetURI("tcp-lines://127.0.0.1:1234"))
_ = await tcp_server.accept()
await tcp_server.accept()

with pytest.raises(asyncio.TimeoutError):
await client.request(b"hello", timeout=0.5)

0 comments on commit 6271e56

Please sign in to comment.