Skip to content

Commit

Permalink
fix: Do not garbage collect the tcp test server
Browse files Browse the repository at this point in the history
  • Loading branch information
rumpelsepp committed Dec 2, 2024
1 parent 53ef5ba commit 2439f07
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/pytest/test_transports.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ 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()
server = await tcp_server.accept()

async with asyncio.TaskGroup() as tg:
tg.create_task(server.read())

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

0 comments on commit 2439f07

Please sign in to comment.