Skip to content

Commit c0b56cd

Browse files
committed
PYTHON-5168 Fix race in test
1 parent 248cb06 commit c0b56cd

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

test/asynchronous/test_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,10 +1808,10 @@ async def fail_connect(*args, **kwargs):
18081808

18091809
await pool.reset_without_pause()
18101810

1811-
await async_wait_until(lambda: len(cm.records) > 0, "start creating connections")
1812-
log_output = "".join(cm.output)
1813-
self.assertIn("failed to connect", log_output)
1814-
self.assertIn("MongoClient background task encountered an error", log_output)
1811+
await async_wait_until(
1812+
lambda: "failed to connect" in "".join(cm.output), "start creating connections"
1813+
)
1814+
self.assertIn("MongoClient background task encountered an error", "".join(cm.output))
18151815

18161816
@async_client_context.require_replica_set
18171817
async def test_direct_connection(self):

test/test_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,10 +1765,10 @@ def fail_connect(*args, **kwargs):
17651765

17661766
pool.reset_without_pause()
17671767

1768-
wait_until(lambda: len(cm.records) > 0, "start creating connections")
1769-
log_output = "".join(cm.output)
1770-
self.assertIn("failed to connect", log_output)
1771-
self.assertIn("MongoClient background task encountered an error", log_output)
1768+
wait_until(
1769+
lambda: "failed to connect" in "".join(cm.output), "start creating connections"
1770+
)
1771+
self.assertIn("MongoClient background task encountered an error", "".join(cm.output))
17721772

17731773
@client_context.require_replica_set
17741774
def test_direct_connection(self):

0 commit comments

Comments
 (0)