Skip to content

Commit

Permalink
[integ-test-framework] Ensure xdist fixture cleanup even when test cr…
Browse files Browse the repository at this point in the history
…ashes

Prior to this commit, the fixture was cleaned up if tests succeeded or tests failed assertion. The fixture was not cleaned up if tests failed severely (e.g. index an item not existed in a list). This commit makes sure the cleanup is always executed

Signed-off-by: Hanwen <[email protected]>
  • Loading branch information
hanwen-cluster committed Oct 30, 2024
1 parent 4f48d09 commit 6d6b08c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/integration-tests/framework/fixture_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,10 @@ def _xdist_session_fixture(request, *args, **kwargs):
fixture_func_kwargs=kwargs,
xdist_worker_id_and_pid=f"{xdist_worker_id}: {pid}",
)
yield shared_fixture.acquire().fixture_return_value
shared_fixture.release()
try:
yield shared_fixture.acquire().fixture_return_value
finally:
shared_fixture.release()

return _xdist_session_fixture

Expand Down

0 comments on commit 6d6b08c

Please sign in to comment.