Skip to content

Commit db0565a

Browse files
Fixed intermittent test failures (Fixes #572)
1 parent 32db48d commit db0565a

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

tests/asyncio/test_asyncio_client.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -891,8 +891,6 @@ def test_handle_reconnect(self, random, wait_for):
891891
side_effect=[ValueError, exceptions.ConnectionError, None]
892892
)
893893
_run(c._handle_reconnect())
894-
print(wait_for.mock.call_count) # logging to debug #572
895-
print(wait_for.mock.call_args_list)
896894
assert wait_for.mock.call_count == 3
897895
assert [x[0][1] for x in asyncio.wait_for.mock.call_args_list] == [
898896
1.5,
@@ -914,8 +912,6 @@ def test_handle_reconnect_max_delay(self, random, wait_for):
914912
side_effect=[ValueError, exceptions.ConnectionError, None]
915913
)
916914
_run(c._handle_reconnect())
917-
print(wait_for.mock.call_count) # logging to debug #572
918-
print(wait_for.mock.call_args_list)
919915
assert wait_for.mock.call_count == 3
920916
assert [x[0][1] for x in asyncio.wait_for.mock.call_args_list] == [
921917
1.5,
@@ -936,12 +932,7 @@ def test_handle_reconnect_max_attempts(self, random, wait_for):
936932
c.connect = AsyncMock(
937933
side_effect=[ValueError, exceptions.ConnectionError, None]
938934
)
939-
c.logger.setLevel('INFO')
940935
_run(c._handle_reconnect())
941-
c.logger.setLevel('ERROR')
942-
print(c.reconnection_attempts)
943-
print(wait_for.mock.call_count) # logging to debug #572
944-
print(wait_for.mock.call_args_list)
945936
assert wait_for.mock.call_count == 2
946937
assert [x[0][1] for x in asyncio.wait_for.mock.call_args_list] == [
947938
1.5,
@@ -957,15 +948,11 @@ def test_handle_reconnect_max_attempts(self, random, wait_for):
957948
@mock.patch('socketio.client.random.random', side_effect=[1, 0, 0.5])
958949
def test_handle_reconnect_aborted(self, random, wait_for):
959950
c = asyncio_client.AsyncClient(logger=True)
960-
c.logger.setLevel('INFO')
961951
c._reconnect_task = 'foo'
962952
c.connect = AsyncMock(
963953
side_effect=[ValueError, exceptions.ConnectionError, None]
964954
)
965955
_run(c._handle_reconnect())
966-
c.logger.setLevel('ERROR')
967-
print(wait_for.mock.call_count) # logging to debug #572
968-
print(wait_for.mock.call_args_list)
969956
assert wait_for.mock.call_count == 2
970957
assert [x[0][1] for x in asyncio.wait_for.mock.call_args_list] == [
971958
1.5,
@@ -1069,7 +1056,7 @@ def test_handle_eio_message(self):
10691056
_run(c._handle_eio_message('9'))
10701057

10711058
def test_eio_disconnect(self):
1072-
c = asyncio_client.AsyncClient()
1059+
c = asyncio_client.AsyncClient(reconnection=False)
10731060
c.namespaces = {'/': '1'}
10741061
c.connected = True
10751062
c._trigger_event = AsyncMock()
@@ -1083,7 +1070,7 @@ def test_eio_disconnect(self):
10831070
assert not c.connected
10841071

10851072
def test_eio_disconnect_namespaces(self):
1086-
c = asyncio_client.AsyncClient()
1073+
c = asyncio_client.AsyncClient(reconnection=False)
10871074
c.namespaces = {'/foo': '1', '/bar': '2'}
10881075
c.connected = True
10891076
c._trigger_event = AsyncMock()

0 commit comments

Comments
 (0)