mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04: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
@ -195,7 +195,12 @@ class WebSocketTest(BaseTest):
|
|||||||
expected_messages.append(ex)
|
expected_messages.append(ex)
|
||||||
if send_close:
|
if send_close:
|
||||||
client.write_close(close_code, close_reason)
|
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.ae(expected_messages, messages)
|
||||||
self.assertGreaterEqual(len(control_frames), 1)
|
self.assertGreaterEqual(len(control_frames), 1)
|
||||||
self.ae(expected_controls, control_frames[:-1])
|
self.ae(expected_controls, control_frames[:-1])
|
||||||
@ -317,3 +322,8 @@ class WebSocketTest(BaseTest):
|
|||||||
sz *= 1024
|
sz *= 1024
|
||||||
t, b = 'a'*sz, b'a'*sz
|
t, b = 'a'*sz, b'a'*sz
|
||||||
simple_test([t, b], [t, b])
|
simple_test([t, b], [t, b])
|
||||||
|
|
||||||
|
|
||||||
|
def find_tests():
|
||||||
|
import unittest
|
||||||
|
return unittest.defaultTestLoader.loadTestsFromTestCase(WebSocketTest)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user