Skip to content

Commit e1d091f

Browse files
committed
fix test
1 parent d03c78f commit e1d091f

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

test/asynchronous/test_client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,8 +1054,12 @@ async def test_uri_connect_option(self):
10541054
client = await self.async_rs_client(connect=False)
10551055

10561056
# Ensure kill cursors thread has not been started.
1057-
# _kill_cursors_executor is initialized upon client connection
1058-
self.assertFalse(hasattr(client, "_kill_cursors_executor"))
1057+
if _IS_SYNC:
1058+
kc_thread = client._kill_cursors_executor._thread
1059+
self.assertFalse(kc_thread and kc_thread.is_alive())
1060+
else:
1061+
kc_task = client._kill_cursors_executor._task
1062+
self.assertFalse(kc_task and not kc_task.done())
10591063
# Using the client should open topology and start the thread.
10601064
await client.admin.command("ping")
10611065
self.assertTrue(client._topology._opened)

test/test_client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,8 +1027,12 @@ def test_uri_connect_option(self):
10271027
client = self.rs_client(connect=False)
10281028

10291029
# Ensure kill cursors thread has not been started.
1030-
# _kill_cursors_executor is initialized upon client connection
1031-
self.assertFalse(hasattr(client, "_kill_cursors_executor"))
1030+
if _IS_SYNC:
1031+
kc_thread = client._kill_cursors_executor._thread
1032+
self.assertFalse(kc_thread and kc_thread.is_alive())
1033+
else:
1034+
kc_task = client._kill_cursors_executor._task
1035+
self.assertFalse(kc_task and not kc_task.done())
10321036
# Using the client should open topology and start the thread.
10331037
client.admin.command("ping")
10341038
self.assertTrue(client._topology._opened)

0 commit comments

Comments
 (0)