Skip to content

Commit 47b2257

Browse files
PYTHON-4641 Fix failure in async version of client bulk CSOT test (#1790)
1 parent a232b65 commit 47b2257

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

test/asynchronous/test_client_bulk_write.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ async def test_returns_error_if_auto_encryption_configured(self):
523523

524524

525525
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#11-multi-batch-bulkwrites
526-
class TestClientBulkWriteTimeout(AsyncIntegrationTest):
526+
class TestClientBulkWriteCSOT(AsyncIntegrationTest):
527527
async def asyncSetUp(self):
528528
self.max_write_batch_size = await async_client_context.max_write_batch_size
529529
self.max_bson_object_size = await async_client_context.max_bson_size
@@ -567,6 +567,7 @@ async def test_timeout_in_multi_batch_bulk_write(self):
567567
w="majority",
568568
)
569569
self.addAsyncCleanup(client.aclose)
570+
await client.admin.command("ping") # Init the client first.
570571
with self.assertRaises(ClientBulkWriteException) as context:
571572
await client.bulk_write(models=models)
572573
self.assertIsInstance(context.exception.error, NetworkTimeout)

test/test_client_bulk_write.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ def test_returns_error_if_auto_encryption_configured(self):
523523

524524

525525
# https://github.com/mongodb/specifications/blob/master/source/client-side-operations-timeout/tests/README.md#11-multi-batch-bulkwrites
526-
class TestClientBulkWriteTimeout(IntegrationTest):
526+
class TestClientBulkWriteCSOT(IntegrationTest):
527527
def setUp(self):
528528
self.max_write_batch_size = client_context.max_write_batch_size
529529
self.max_bson_object_size = client_context.max_bson_size
@@ -567,6 +567,7 @@ def test_timeout_in_multi_batch_bulk_write(self):
567567
w="majority",
568568
)
569569
self.addCleanup(client.close)
570+
client.admin.command("ping") # Init the client first.
570571
with self.assertRaises(ClientBulkWriteException) as context:
571572
client.bulk_write(models=models)
572573
self.assertIsInstance(context.exception.error, NetworkTimeout)

0 commit comments

Comments
 (0)