PYTHON-5114 Test suite reduce killAllSessions calls (#2721)
This commit is contained in:
parent
38da6c3f9a
commit
f303125cee
@ -1464,11 +1464,6 @@ class UnifiedSpecTestMixinV1(AsyncIntegrationTest):
|
||||
self.assertListEqual(sorted_expected_documents, actual_documents)
|
||||
|
||||
async def run_scenario(self, spec, uri=None):
|
||||
# Kill all sessions before and after each test to prevent an open
|
||||
# transaction (from a test failure) from blocking collection/database
|
||||
# operations during test set up and tear down.
|
||||
await self.kill_all_sessions()
|
||||
|
||||
# Handle flaky tests.
|
||||
flaky_tests = [
|
||||
("PYTHON-5170", ".*test_discovery_and_monitoring.*"),
|
||||
@ -1504,6 +1499,15 @@ class UnifiedSpecTestMixinV1(AsyncIntegrationTest):
|
||||
if skip_reason is not None:
|
||||
raise unittest.SkipTest(f"{skip_reason}")
|
||||
|
||||
# Kill all sessions after each test with transactions to prevent an open
|
||||
# transaction (from a test failure) from blocking collection/database
|
||||
# operations during test set up and tear down.
|
||||
for op in spec["operations"]:
|
||||
name = op["name"]
|
||||
if name == "startTransaction" or name == "withTransaction":
|
||||
self.addAsyncCleanup(self.kill_all_sessions)
|
||||
break
|
||||
|
||||
# process createEntities
|
||||
self._uri = uri
|
||||
self.entity_map = EntityMapUtil(self)
|
||||
|
||||
@ -1451,11 +1451,6 @@ class UnifiedSpecTestMixinV1(IntegrationTest):
|
||||
self.assertListEqual(sorted_expected_documents, actual_documents)
|
||||
|
||||
def run_scenario(self, spec, uri=None):
|
||||
# Kill all sessions before and after each test to prevent an open
|
||||
# transaction (from a test failure) from blocking collection/database
|
||||
# operations during test set up and tear down.
|
||||
self.kill_all_sessions()
|
||||
|
||||
# Handle flaky tests.
|
||||
flaky_tests = [
|
||||
("PYTHON-5170", ".*test_discovery_and_monitoring.*"),
|
||||
@ -1491,6 +1486,15 @@ class UnifiedSpecTestMixinV1(IntegrationTest):
|
||||
if skip_reason is not None:
|
||||
raise unittest.SkipTest(f"{skip_reason}")
|
||||
|
||||
# Kill all sessions after each test with transactions to prevent an open
|
||||
# transaction (from a test failure) from blocking collection/database
|
||||
# operations during test set up and tear down.
|
||||
for op in spec["operations"]:
|
||||
name = op["name"]
|
||||
if name == "startTransaction" or name == "withTransaction":
|
||||
self.addCleanup(self.kill_all_sessions)
|
||||
break
|
||||
|
||||
# process createEntities
|
||||
self._uri = uri
|
||||
self.entity_map = EntityMapUtil(self)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user