mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 23:03:26 +02:00
Dont fail the websocket test when sending garbage and the connection is unexpectedly closed by the OS
This commit is contained in:
parent
0f852ee6f3
commit
881d2a4ae9
1 changed files with 11 additions and 1 deletions
|
|
@ -195,7 +195,12 @@ def simple_test(self, server, msgs, expected=(), close_code=NORMAL_CLOSE, send_c
|
|||
expected_messages.append(ex)
|
||||
if send_close:
|
||||
client.write_close(close_code, close_reason)
|
||||
messages, control_frames = client.read_messages()
|
||||
try:
|
||||
messages, control_frames = client.read_messages()
|
||||
except ConnectionAbortedError:
|
||||
if expected_messages or expected_controls or send_close:
|
||||
raise
|
||||
return
|
||||
self.ae(expected_messages, messages)
|
||||
self.assertGreaterEqual(len(control_frames), 1)
|
||||
self.ae(expected_controls, control_frames[:-1])
|
||||
|
|
@ -317,3 +322,8 @@ def test_websocket_perf(self):
|
|||
sz *= 1024
|
||||
t, b = 'a'*sz, b'a'*sz
|
||||
simple_test([t, b], [t, b])
|
||||
|
||||
|
||||
def find_tests():
|
||||
import unittest
|
||||
return unittest.defaultTestLoader.loadTestsFromTestCase(WebSocketTest)
|
||||
|
|
|
|||
Loading…
Reference in a new issue