PYTHON-1590 Avoid thread limit in tests

This commit is contained in:
Shane Harvey 2018-06-15 11:58:01 -07:00
parent b5e9007af0
commit 9d8024d9ea
2 changed files with 4 additions and 0 deletions

View File

@ -97,6 +97,8 @@ def create_test(scenario_def, test):
error = None
db = rs_or_single_client(**test['clientOptions']).pymongo_test
# Close the client explicitly to avoid having too many threads open.
self.addCleanup(db.client.close)
try:
result = run_operation(db.test, test)
except (ConnectionFailure, OperationFailure) as exc:

View File

@ -347,6 +347,8 @@ def create_test(scenario_def, test):
# with ScenarioDict.
client = rs_client(event_listeners=[listener],
**dict(test['clientOptions']))
# Close the client explicitly to avoid having too many threads open.
self.addCleanup(client.close)
# Kill all sessions before and after each test to prevent an open
# transaction (from a test failure) from blocking collection/database