Skip to content

Commit

Permalink
Fix a warning in modern unittest. (#773)
Browse files Browse the repository at this point in the history
Newer versions of unittest no longer store an errors
list; instead, they store a result, which then stores
an error list.  Update the code here to be able to deal
with either version.

Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette authored Mar 29, 2024
1 parent 72ffcb5 commit 9390852
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion launch_testing/launch_testing/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ def _wrapper(self, *args, **kwargs):
assert self._outcome.success
return ret
except AssertionError:
self._outcome.errors.clear()
if hasattr(self._outcome, 'errors'):
self._outcome.errors.clear()
else:
if self._outcome.result is not None:
self._outcome.result.errors.clear()
self._outcome.success = True
n -= 1
if delay is not None:
Expand Down

0 comments on commit 9390852

Please sign in to comment.