Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions test/asynchronous/unified_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -1464,11 +1464,6 @@ async def verify_outcome(self, spec):
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.*"),
Expand Down Expand Up @@ -1504,6 +1499,15 @@ async def _run_scenario(self, spec, uri=None):
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)
Expand Down
Loading
Loading