Skip to content

Commit

Permalink
instrumentation to track #572 #nolog
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Oct 17, 2021
1 parent f245191 commit 8c15b77
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/asyncio/test_asyncio_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,12 +931,14 @@ def test_handle_reconnect_max_delay(self, random, wait_for):
)
@mock.patch('socketio.client.random.random', side_effect=[1, 0, 0.5])
def test_handle_reconnect_max_attempts(self, random, wait_for):
c = asyncio_client.AsyncClient(reconnection_attempts=2)
c = asyncio_client.AsyncClient(reconnection_attempts=2, logger=True)
c._reconnect_task = 'foo'
c.connect = AsyncMock(
side_effect=[ValueError, exceptions.ConnectionError, None]
)
c.logger.setLevel('INFO')
_run(c._handle_reconnect())
c.logger.setLevel('ERROR')
print(c.reconnection_attempts)
print(wait_for.mock.call_count) # logging to debug #572
print(wait_for.mock.call_args_list)
Expand All @@ -954,12 +956,14 @@ def test_handle_reconnect_max_attempts(self, random, wait_for):
)
@mock.patch('socketio.client.random.random', side_effect=[1, 0, 0.5])
def test_handle_reconnect_aborted(self, random, wait_for):
c = asyncio_client.AsyncClient()
c = asyncio_client.AsyncClient(logger=True)
c.logger.setLevel('INFO')
c._reconnect_task = 'foo'
c.connect = AsyncMock(
side_effect=[ValueError, exceptions.ConnectionError, None]
)
_run(c._handle_reconnect())
c.logger.setLevel('ERROR')
print(wait_for.mock.call_count) # logging to debug #572
print(wait_for.mock.call_args_list)
assert wait_for.mock.call_count == 2
Expand Down

0 comments on commit 8c15b77

Please sign in to comment.