Skip to content

Commit

Permalink
Work around coverage issue in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaugustin committed Feb 19, 2022
1 parent c3560c9 commit 1882bd1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/legacy/test_client_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,8 @@ async def run_client():
connect_inst.BACKOFF_MIN = 10 * MS
connect_inst.BACKOFF_MAX = 99 * MS
connect_inst.BACKOFF_INITIAL = 0
async for ws in connect_inst:
# coverage has a hard time dealing with this code - I give up.
async for ws in connect_inst: # pragma: no cover
await ws.send("spam")
msg = await ws.recv()
self.assertEqual(msg, "spam")
Expand All @@ -1457,10 +1458,10 @@ async def run_client():
await server_ws.close()
with self.assertRaises(ConnectionClosed):
await ws.recv()
pass # work around bug in coverage
else:
# Exit block with an exception.
raise Exception("BOOM!")
pass # work around bug in coverage

with self.assertLogs("websockets", logging.INFO) as logs:
with self.assertRaisesRegex(Exception, "BOOM!"):
Expand Down

0 comments on commit 1882bd1

Please sign in to comment.