@@ -45,7 +45,10 @@ async def test_reconnect_policy_none(
4545 stype_in = SType .RAW_SYMBOL ,
4646 symbols = "TEST" ,
4747 )
48- live_client ._session ._protocol .disconnected .set_exception (ConnectionResetError )
48+ live_client ._loop .call_soon_threadsafe (
49+ live_client ._session ._protocol .disconnected .set_exception ,
50+ ConnectionResetError ,
51+ )
4952
5053 await mock_live_server .wait_for_message_of_type (AuthenticationRequest )
5154
@@ -90,7 +93,10 @@ async def test_reconnect_before_start(
9093 live_client .add_callback (records .append )
9194
9295 # Act
93- live_client ._session ._protocol .disconnected .set_exception (ConnectionResetError )
96+ live_client ._loop .call_soon_threadsafe (
97+ live_client ._session ._protocol .disconnected .set_exception ,
98+ ConnectionResetError ,
99+ )
94100 await mock_live_server .disconnect (
95101 session_id = live_client ._session .session_id ,
96102 )
@@ -162,7 +168,10 @@ async def test_reconnect_subscriptions(
162168 await mock_live_server .wait_for_message_of_type (AuthenticationRequest )
163169
164170 # Act
165- live_client ._session ._protocol .disconnected .set_exception (ConnectionResetError )
171+ live_client ._loop .call_soon_threadsafe (
172+ live_client ._session ._protocol .disconnected .set_exception ,
173+ ConnectionResetError ,
174+ )
166175 await mock_live_server .disconnect (
167176 session_id = live_client ._session .session_id ,
168177 )
@@ -217,8 +226,11 @@ async def test_reconnect_callback(
217226
218227 # Act
219228 live_client .start ()
220- live_client ._session ._protocol .disconnected .set_exception (ConnectionResetError )
221229
230+ live_client ._loop .call_soon_threadsafe (
231+ live_client ._session ._protocol .disconnected .set_exception ,
232+ ConnectionResetError ,
233+ )
222234 await mock_live_server .wait_for_message_of_type (SessionStart )
223235
224236 await live_client .wait_for_close ()
0 commit comments