Skip to content

Commit 9d8024d

Browse files
committed
PYTHON-1590 Avoid thread limit in tests
1 parent b5e9007 commit 9d8024d

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

test/test_retryable_writes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ def run_scenario(self):
9797
error = None
9898

9999
db = rs_or_single_client(**test['clientOptions']).pymongo_test
100+
# Close the client explicitly to avoid having too many threads open.
101+
self.addCleanup(db.client.close)
100102
try:
101103
result = run_operation(db.test, test)
102104
except (ConnectionFailure, OperationFailure) as exc:

test/test_transactions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ def run_scenario(self):
347347
# with ScenarioDict.
348348
client = rs_client(event_listeners=[listener],
349349
**dict(test['clientOptions']))
350+
# Close the client explicitly to avoid having too many threads open.
351+
self.addCleanup(client.close)
350352

351353
# Kill all sessions before and after each test to prevent an open
352354
# transaction (from a test failure) from blocking collection/database

0 commit comments

Comments
 (0)