Skip to content

Commit 8c15b77

Browse files
instrumentation to track #572 #nolog
1 parent f245191 commit 8c15b77

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/asyncio/test_asyncio_client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -931,12 +931,14 @@ def test_handle_reconnect_max_delay(self, random, wait_for):
931931
)
932932
@mock.patch('socketio.client.random.random', side_effect=[1, 0, 0.5])
933933
def test_handle_reconnect_max_attempts(self, random, wait_for):
934-
c = asyncio_client.AsyncClient(reconnection_attempts=2)
934+
c = asyncio_client.AsyncClient(reconnection_attempts=2, logger=True)
935935
c._reconnect_task = 'foo'
936936
c.connect = AsyncMock(
937937
side_effect=[ValueError, exceptions.ConnectionError, None]
938938
)
939+
c.logger.setLevel('INFO')
939940
_run(c._handle_reconnect())
941+
c.logger.setLevel('ERROR')
940942
print(c.reconnection_attempts)
941943
print(wait_for.mock.call_count) # logging to debug #572
942944
print(wait_for.mock.call_args_list)
@@ -954,12 +956,14 @@ def test_handle_reconnect_max_attempts(self, random, wait_for):
954956
)
955957
@mock.patch('socketio.client.random.random', side_effect=[1, 0, 0.5])
956958
def test_handle_reconnect_aborted(self, random, wait_for):
957-
c = asyncio_client.AsyncClient()
959+
c = asyncio_client.AsyncClient(logger=True)
960+
c.logger.setLevel('INFO')
958961
c._reconnect_task = 'foo'
959962
c.connect = AsyncMock(
960963
side_effect=[ValueError, exceptions.ConnectionError, None]
961964
)
962965
_run(c._handle_reconnect())
966+
c.logger.setLevel('ERROR')
963967
print(wait_for.mock.call_count) # logging to debug #572
964968
print(wait_for.mock.call_args_list)
965969
assert wait_for.mock.call_count == 2

0 commit comments

Comments
 (0)