Skip to content

Commit

Permalink
PYTHON-4996 - Ensure all async integration tests call their parent as…
Browse files Browse the repository at this point in the history
…yncSetup method (#2023)
  • Loading branch information
NoahStapp authored Dec 2, 2024
1 parent a9e61f6 commit f45b35a
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/asynchronous/test_client_bulk_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ async def test_raw_bson_not_inflated(self):
# https://github.com/mongodb/specifications/tree/master/source/crud/tests
class TestClientBulkWriteCRUD(AsyncIntegrationTest):
async def asyncSetUp(self):
await super().asyncSetUp()
self.max_write_batch_size = await async_client_context.max_write_batch_size
self.max_bson_object_size = await async_client_context.max_bson_size
self.max_message_size_bytes = await async_client_context.max_message_size_bytes
Expand Down Expand Up @@ -652,6 +653,7 @@ class TestClientBulkWriteCSOT(AsyncIntegrationTest):
async def asyncSetUp(self):
if os.environ.get("SKIP_CSOT_TESTS", ""):
raise unittest.SkipTest("SKIP_CSOT_TESTS is set, skipping...")
await super().asyncSetUp()
self.max_write_batch_size = await async_client_context.max_write_batch_size
self.max_bson_object_size = await async_client_context.max_bson_size
self.max_message_size_bytes = await async_client_context.max_message_size_bytes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class TestAsyncConnectionsSurvivePrimaryStepDown(AsyncIntegrationTest):

@async_client_context.require_replica_set
async def asyncSetUp(self):
await super().asyncSetUp()
self.listener = CMAPListener()
self.client = await self.async_rs_or_single_client(
event_listeners=[self.listener], retryWrites=False, heartbeatFrequencyMS=500
Expand Down
2 changes: 2 additions & 0 deletions test/test_client_bulk_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def test_raw_bson_not_inflated(self):
# https://github.com/mongodb/specifications/tree/master/source/crud/tests
class TestClientBulkWriteCRUD(IntegrationTest):
def setUp(self):
super().setUp()
self.max_write_batch_size = client_context.max_write_batch_size
self.max_bson_object_size = client_context.max_bson_size
self.max_message_size_bytes = client_context.max_message_size_bytes
Expand Down Expand Up @@ -648,6 +649,7 @@ class TestClientBulkWriteCSOT(IntegrationTest):
def setUp(self):
if os.environ.get("SKIP_CSOT_TESTS", ""):
raise unittest.SkipTest("SKIP_CSOT_TESTS is set, skipping...")
super().setUp()
self.max_write_batch_size = client_context.max_write_batch_size
self.max_bson_object_size = client_context.max_bson_size
self.max_message_size_bytes = client_context.max_message_size_bytes
Expand Down
1 change: 1 addition & 0 deletions test/test_connections_survive_primary_stepdown_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class TestConnectionsSurvivePrimaryStepDown(IntegrationTest):

@client_context.require_replica_set
def setUp(self):
super().setUp()
self.listener = CMAPListener()
self.client = self.rs_or_single_client(
event_listeners=[self.listener], retryWrites=False, heartbeatFrequencyMS=500
Expand Down
1 change: 1 addition & 0 deletions test/test_gridfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ def setUp(self):
super().setUp()

@classmethod
@client_context.require_connection
def tearDownClass(cls):
client_context.client.drop_database("gfsreplica")

Expand Down
1 change: 1 addition & 0 deletions test/test_gridfs_bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ def setUp(self):
super().setUp()

@classmethod
@client_context.require_connection
def tearDownClass(cls):
client_context.client.drop_database("gfsbucketreplica")

Expand Down

0 comments on commit f45b35a

Please sign in to comment.