Skip to content

Commit 17d0e4c

Browse files
committed
address review -ish
1 parent 041e4e7 commit 17d0e4c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

test/asynchronous/test_discovery_and_monitoring.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def create_tests():
251251
setattr(TestAllScenarios, new_test.__name__, new_test)
252252

253253

254-
class TestClusterTimeComparison(unittest.IsolatedAsyncioTestCase):
254+
class TestClusterTimeComparison(AsyncPyMongoTestCase):
255255
async def test_cluster_time_comparison(self):
256256
t = await create_mock_topology("mongodb://host")
257257

@@ -297,7 +297,7 @@ async def test_ignore_stale_connection_errors(self):
297297
await async_wait_until(lambda: len(pool.conns) == N_TASKS, "created conns")
298298

299299
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.
301301
await async_barrier_wait(barrier, timeout=30)
302302
raise AutoReconnect("mock AsyncConnection.command error")
303303

@@ -446,14 +446,14 @@ async def test_heartbeat_start_ordering(self):
446446
if _IS_SYNC:
447447
server = TCPServer(("localhost", 9999), MockTCPHandler)
448448
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()
451451
_c = await self.simple_client(
452452
"mongodb://localhost:9999",
453453
serverSelectionTimeoutMS=500,
454454
event_listeners=(listener,),
455455
)
456-
server_thread.join()
456+
await server_thread.join()
457457
listener.wait_for_event(ServerHeartbeatStartedEvent, 1)
458458
listener.wait_for_event(ServerHeartbeatFailedEvent, 1)
459459

test/test_discovery_and_monitoring.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def create_tests():
251251
setattr(TestAllScenarios, new_test.__name__, new_test)
252252

253253

254-
class TestClusterTimeComparison(unittest.TestCase):
254+
class TestClusterTimeComparison(PyMongoTestCase):
255255
def test_cluster_time_comparison(self):
256256
t = create_mock_topology("mongodb://host")
257257

@@ -297,7 +297,7 @@ def test_ignore_stale_connection_errors(self):
297297
wait_until(lambda: len(pool.conns) == N_TASKS, "created conns")
298298

299299
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.
301301
barrier_wait(barrier, timeout=30)
302302
raise AutoReconnect("mock Connection.command error")
303303

@@ -446,7 +446,7 @@ def test_heartbeat_start_ordering(self):
446446
if _IS_SYNC:
447447
server = TCPServer(("localhost", 9999), MockTCPHandler)
448448
server.events = events
449-
server_thread = threading.Thread(target=server.handle_request_and_shutdown)
449+
server_thread = ConcurrentRunner(target=server.handle_request_and_shutdown)
450450
server_thread.start()
451451
_c = self.simple_client(
452452
"mongodb://localhost:9999",

0 commit comments

Comments
 (0)