@@ -1495,7 +1495,6 @@ async def _test_explicit(self, expectation):
14951495 async_client_context .client ,
14961496 OPTS ,
14971497 )
1498- self .addAsyncCleanup (client_encryption .close )
14991498
15001499 ciphertext = await client_encryption .encrypt (
15011500 "string0" ,
@@ -1521,7 +1520,6 @@ async def _test_automatic(self, expectation_extjson, payload):
15211520 client = await self .async_rs_or_single_client (
15221521 auto_encryption_opts = encryption_opts , event_listeners = [insert_listener ]
15231522 )
1524- self .addAsyncCleanup (client .aclose )
15251523
15261524 coll = client .get_database (encrypted_db ).get_collection (
15271525 encrypted_coll , codec_options = OPTS , write_concern = WriteConcern ("majority" )
@@ -1545,10 +1543,10 @@ async def _test_automatic(self, expectation_extjson, payload):
15451543class TestAzureEncryption (AzureGCPEncryptionTestMixin , AsyncEncryptionIntegrationTest ):
15461544 @unittest .skipUnless (any (AZURE_CREDS .values ()), "Azure environment credentials are not set" )
15471545 async def asyncSetUp (self ):
1546+ await super ().asyncSetUp ()
15481547 self .KMS_PROVIDER_MAP = {"azure" : AZURE_CREDS }
15491548 self .DEK = json_data (BASE , "custom" , "azure-dek.json" )
15501549 self .SCHEMA_MAP = json_data (BASE , "custom" , "azure-gcp-schema.json" )
1551- await super ().asyncSetUp ()
15521550
15531551 async def test_explicit (self ):
15541552 return await self ._test_explicit (
@@ -1570,10 +1568,10 @@ async def test_automatic(self):
15701568class TestGCPEncryption (AzureGCPEncryptionTestMixin , AsyncEncryptionIntegrationTest ):
15711569 @unittest .skipUnless (any (GCP_CREDS .values ()), "GCP environment credentials are not set" )
15721570 async def asyncSetUp (self ):
1571+ await super ().asyncSetUp ()
15731572 self .KMS_PROVIDER_MAP = {"gcp" : GCP_CREDS }
15741573 self .DEK = json_data (BASE , "custom" , "gcp-dek.json" )
15751574 self .SCHEMA_MAP = json_data (BASE , "custom" , "azure-gcp-schema.json" )
1576- await super ().asyncSetUp ()
15771575
15781576 async def test_explicit (self ):
15791577 return await self ._test_explicit (
@@ -1595,6 +1593,7 @@ async def test_automatic(self):
15951593# https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#deadlock-tests
15961594class TestDeadlockProse (AsyncEncryptionIntegrationTest ):
15971595 async def asyncSetUp (self ):
1596+ await super ().asyncSetUp ()
15981597 self .client_test = await self .async_rs_or_single_client (
15991598 maxPoolSize = 1 , readConcernLevel = "majority" , w = "majority" , uuidRepresentation = "standard"
16001599 )
@@ -1627,7 +1626,6 @@ async def asyncSetUp(self):
16271626 self .ciphertext = await client_encryption .encrypt (
16281627 "string0" , Algorithm .AEAD_AES_256_CBC_HMAC_SHA_512_Deterministic , key_alt_name = "local"
16291628 )
1630- await client_encryption .close ()
16311629
16321630 self .client_listener = OvertCommandListener ()
16331631 self .topology_listener = TopologyEventListener ()
@@ -1822,6 +1820,7 @@ async def test_case_8(self):
18221820# https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#14-decryption-events
18231821class TestDecryptProse (AsyncEncryptionIntegrationTest ):
18241822 async def asyncSetUp (self ):
1823+ await super ().asyncSetUp ()
18251824 self .client = async_client_context .client
18261825 await self .client .db .drop_collection ("decryption_events" )
18271826 await create_key_vault (self .client .keyvault .datakeys )
@@ -2257,6 +2256,7 @@ async def test_06_named_kms_providers_apply_tls_options_kmip(self):
22572256# https://github.com/mongodb/specifications/blob/50e26fe/source/client-side-encryption/tests/README.md#unique-index-on-keyaltnames
22582257class TestUniqueIndexOnKeyAltNamesProse (AsyncEncryptionIntegrationTest ):
22592258 async def asyncSetUp (self ):
2259+ await super ().asyncSetUp ()
22602260 self .client = async_client_context .client
22612261 await create_key_vault (self .client .keyvault .datakeys )
22622262 kms_providers_map = {"local" : {"key" : LOCAL_MASTER_KEY }}
@@ -2606,8 +2606,6 @@ async def AsyncMongoClient(**kwargs):
26062606 assert isinstance (res ["encrypted_indexed" ], Binary )
26072607 assert isinstance (res ["encrypted_unindexed" ], Binary )
26082608
2609- await client_encryption .close ()
2610-
26112609
26122610# https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#22-range-explicit-encryption
26132611class TestRangeQueryProse (AsyncEncryptionIntegrationTest ):
0 commit comments