@@ -251,7 +251,7 @@ def create_tests():
251
251
setattr (TestAllScenarios , new_test .__name__ , new_test )
252
252
253
253
254
- class TestClusterTimeComparison (unittest . IsolatedAsyncioTestCase ):
254
+ class TestClusterTimeComparison (AsyncPyMongoTestCase ):
255
255
async def test_cluster_time_comparison (self ):
256
256
t = await create_mock_topology ("mongodb://host" )
257
257
@@ -297,7 +297,7 @@ async def test_ignore_stale_connection_errors(self):
297
297
await async_wait_until (lambda : len (pool .conns ) == N_TASKS , "created conns" )
298
298
299
299
async def mock_command (* args , ** kwargs ):
300
- # Synchronize all threads to ensure they use the same generation.
300
+ # Synchronize all tasks to ensure they use the same generation.
301
301
await async_barrier_wait (barrier , timeout = 30 )
302
302
raise AutoReconnect ("mock AsyncConnection.command error" )
303
303
@@ -446,14 +446,14 @@ async def test_heartbeat_start_ordering(self):
446
446
if _IS_SYNC :
447
447
server = TCPServer (("localhost" , 9999 ), MockTCPHandler )
448
448
server .events = events
449
- server_thread = threading . Thread (target = server .handle_request_and_shutdown )
450
- server_thread .start ()
449
+ server_thread = ConcurrentRunner (target = server .handle_request_and_shutdown )
450
+ await server_thread .start ()
451
451
_c = await self .simple_client (
452
452
"mongodb://localhost:9999" ,
453
453
serverSelectionTimeoutMS = 500 ,
454
454
event_listeners = (listener ,),
455
455
)
456
- server_thread .join ()
456
+ await server_thread .join ()
457
457
listener .wait_for_event (ServerHeartbeatStartedEvent , 1 )
458
458
listener .wait_for_event (ServerHeartbeatFailedEvent , 1 )
459
459
0 commit comments