Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pytest): call stop for all instances even if stop raise exception #4339

Merged
merged 2 commits into from
Dec 18, 2024
Merged
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
12 changes: 11 additions & 1 deletion tests/dragonfly/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,19 @@ def start_all(self, instances: List[DflyInstance]):

async def stop_all(self):
"""Stop all launched instances."""
exceptions = [] # To collect exceptions
for instance in self.instances:
await instance.close_clients()
instance.stop()
try:
instance.stop()
except Exception as e:
exceptions.append(e) # Collect the exception
if exceptions:
first_exception = exceptions[0]
raise Exception(
f"One or more errors occurred while stopping instances. "
f"First exception: {first_exception}"
) from first_exception

def __repr__(self) -> str:
return f"Factory({self.args})"
Expand Down
Loading