@@ -1102,8 +1102,8 @@ def test_bad_uri(self):
1102
1102
async def test_auth_from_uri (self ):
1103
1103
host , port = await async_client_context .host , await async_client_context .port
1104
1104
await async_client_context .create_user ("admin" , "admin" , "pass" )
1105
- self .addToCleanup (async_client_context .drop_user , "admin" , "admin" )
1106
- self .addToCleanup (remove_all_users , self .client .pymongo_test )
1105
+ self .addAsyncCleanup (async_client_context .drop_user , "admin" , "admin" )
1106
+ self .addAsyncCleanup (remove_all_users , self .client .pymongo_test )
1107
1107
1108
1108
await async_client_context .create_user (
1109
1109
"pymongo_test" , "user" , "pass" , roles = ["userAdmin" , "readWrite" ]
@@ -1149,7 +1149,7 @@ async def test_auth_from_uri(self):
1149
1149
@async_client_context .require_auth
1150
1150
async def test_username_and_password (self ):
1151
1151
await async_client_context .create_user ("admin" , "ad min" , "pa/ss" )
1152
- self .addToCleanup (async_client_context .drop_user , "admin" , "ad min" )
1152
+ self .addAsyncCleanup (async_client_context .drop_user , "admin" , "ad min" )
1153
1153
1154
1154
c = await self .async_rs_or_single_client_noauth (username = "ad min" , password = "pa/ss" )
1155
1155
@@ -1258,7 +1258,6 @@ async def test_socket_timeout(self):
1258
1258
no_timeout = self .client
1259
1259
timeout_sec = 1
1260
1260
timeout = await self .async_rs_or_single_client (socketTimeoutMS = 1000 * timeout_sec )
1261
- self .addToCleanup (timeout .close )
1262
1261
1263
1262
await no_timeout .pymongo_test .drop_collection ("test" )
1264
1263
await no_timeout .pymongo_test .test .insert_one ({"x" : 1 })
@@ -1325,7 +1324,7 @@ async def test_tz_aware(self):
1325
1324
self .assertRaises (ValueError , AsyncMongoClient , tz_aware = "foo" )
1326
1325
1327
1326
aware = await self .async_rs_or_single_client (tz_aware = True )
1328
- self .addToCleanup (aware .close )
1327
+ self .addAsyncCleanup (aware .close )
1329
1328
naive = self .client
1330
1329
await aware .pymongo_test .drop_collection ("test" )
1331
1330
@@ -1477,7 +1476,7 @@ async def test_lazy_connect_w0(self):
1477
1476
# Use a separate collection to avoid races where we're still
1478
1477
# completing an operation on a collection while the next test begins.
1479
1478
await async_client_context .client .drop_database ("test_lazy_connect_w0" )
1480
- self .addToCleanup (async_client_context .client .drop_database , "test_lazy_connect_w0" )
1479
+ self .addAsyncCleanup (async_client_context .client .drop_database , "test_lazy_connect_w0" )
1481
1480
1482
1481
client = await self .async_rs_or_single_client (connect = False , w = 0 )
1483
1482
await client .test_lazy_connect_w0 .test .insert_one ({})
@@ -2160,7 +2159,7 @@ async def test_exhaust_getmore_server_error(self):
2160
2159
await collection .drop ()
2161
2160
2162
2161
await collection .insert_many ([{} for _ in range (200 )])
2163
- self .addToCleanup (async_client_context .client .pymongo_test .test .drop )
2162
+ self .addAsyncCleanup (async_client_context .client .pymongo_test .test .drop )
2164
2163
2165
2164
pool = await async_get_pool (client )
2166
2165
pool ._check_interval_seconds = None # Never check.
@@ -2407,7 +2406,7 @@ async def test_discover_primary(self):
2407
2406
replicaSet = "rs" ,
2408
2407
heartbeatFrequencyMS = 500 ,
2409
2408
)
2410
- self .addToCleanup (c .close )
2409
+ self .addAsyncCleanup (c .close )
2411
2410
2412
2411
await async_wait_until (lambda : len (c .nodes ) == 3 , "connect" )
2413
2412
@@ -2434,7 +2433,7 @@ async def test_reconnect(self):
2434
2433
retryReads = False ,
2435
2434
serverSelectionTimeoutMS = 1000 ,
2436
2435
)
2437
- self .addToCleanup (c .close )
2436
+ self .addAsyncCleanup (c .close )
2438
2437
2439
2438
await async_wait_until (lambda : len (c .nodes ) == 3 , "connect" )
2440
2439
@@ -2472,7 +2471,7 @@ async def _test_network_error(self, operation_callback):
2472
2471
serverSelectionTimeoutMS = 1000 ,
2473
2472
)
2474
2473
2475
- self .addToCleanup (c .close )
2474
+ self .addAsyncCleanup (c .close )
2476
2475
2477
2476
# Set host-specific information so we can test whether it is reset.
2478
2477
c .set_wire_version_range ("a:1" , 2 , MIN_SUPPORTED_WIRE_VERSION )
@@ -2548,7 +2547,7 @@ async def test_rs_client_does_not_maintain_pool_to_arbiters(self):
2548
2547
minPoolSize = 1 , # minPoolSize
2549
2548
event_listeners = [listener ],
2550
2549
)
2551
- self .addToCleanup (c .close )
2550
+ self .addAsyncCleanup (c .close )
2552
2551
2553
2552
await async_wait_until (lambda : len (c .nodes ) == 3 , "connect" )
2554
2553
self .assertEqual (await c .address , ("a" , 1 ))
@@ -2578,7 +2577,7 @@ async def test_direct_client_maintains_pool_to_arbiter(self):
2578
2577
minPoolSize = 1 , # minPoolSize
2579
2578
event_listeners = [listener ],
2580
2579
)
2581
- self .addToCleanup (c .close )
2580
+ self .addAsyncCleanup (c .close )
2582
2581
2583
2582
await async_wait_until (lambda : len (c .nodes ) == 1 , "connect" )
2584
2583
self .assertEqual (await c .address , ("c" , 3 ))
0 commit comments