Skip to content

Commit

Permalink
Add test that reproduces error without fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nmichaud committed Sep 21, 2020
1 parent 2c015b1 commit 7db1033
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,18 @@ async def handler(request):
await client_ws.send_message('Hello from client!')


async def test_server_sends_after_close(nursery):
async def handler(request):
server_ws = await request.accept()
with pytest.raises(ConnectionClosed):
await server_ws.send_message("Hello from server")
server = await nursery.start(serve_websocket, handler, HOST, 0, None)
stream = await trio.open_tcp_stream(HOST, server.port)
client_ws = await wrap_client_stream(nursery, stream, HOST, RESOURCE)
async with client_ws:
await stream.aclose()


async def test_server_does_not_close_handshake(nursery):
async def handler(stream):
request = await wrap_server_stream(nursery, stream)
Expand Down

0 comments on commit 7db1033

Please sign in to comment.