From 8c15b77c9b7f72e104350d2d61ffabbfb6686f0e Mon Sep 17 00:00:00 2001 From: Miguel Grinberg Date: Sun, 17 Oct 2021 23:35:33 +0100 Subject: [PATCH] instrumentation to track #572 #nolog --- tests/asyncio/test_asyncio_client.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/asyncio/test_asyncio_client.py b/tests/asyncio/test_asyncio_client.py index fe3414e..17d70d8 100644 --- a/tests/asyncio/test_asyncio_client.py +++ b/tests/asyncio/test_asyncio_client.py @@ -931,12 +931,14 @@ class TestAsyncClient(unittest.TestCase): ) @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) @@ -954,12 +956,14 @@ class TestAsyncClient(unittest.TestCase): ) @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