Skip to content

Commit 77182fe

Browse files
committed
PYTHON-5114 Revert spec runner changes
1 parent dd08d2d commit 77182fe

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

test/asynchronous/utils_spec_runner.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -621,14 +621,11 @@ async def setup_scenario(self, scenario_def):
621621
async def run_scenario(self, scenario_def, test):
622622
self.maybe_skip_scenario(test)
623623

624-
# Kill all sessions after each test with transactions to prevent an open
624+
# Kill all sessions before and after each test to prevent an open
625625
# transaction (from a test failure) from blocking collection/database
626626
# operations during test set up and tear down.
627-
for op in test["operations"]:
628-
name = op["name"]
629-
if name == "startTransaction" or name == "withTransaction":
630-
self.addAsyncCleanup(self.kill_all_sessions)
631-
break
627+
await self.kill_all_sessions()
628+
self.addAsyncCleanup(self.kill_all_sessions)
632629
await self.setup_scenario(scenario_def)
633630
database_name = self.get_scenario_db_name(scenario_def)
634631
collection_name = self.get_scenario_coll_name(scenario_def)

test/utils_spec_runner.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -621,14 +621,11 @@ def setup_scenario(self, scenario_def):
621621
def run_scenario(self, scenario_def, test):
622622
self.maybe_skip_scenario(test)
623623

624-
# Kill all sessions after each test with transactions to prevent an open
624+
# Kill all sessions before and after each test to prevent an open
625625
# transaction (from a test failure) from blocking collection/database
626626
# operations during test set up and tear down.
627-
for op in test["operations"]:
628-
name = op["name"]
629-
if name == "startTransaction" or name == "withTransaction":
630-
self.addCleanup(self.kill_all_sessions)
631-
break
627+
self.kill_all_sessions()
628+
self.addCleanup(self.kill_all_sessions)
632629
self.setup_scenario(scenario_def)
633630
database_name = self.get_scenario_db_name(scenario_def)
634631
collection_name = self.get_scenario_coll_name(scenario_def)

0 commit comments

Comments
 (0)