Skip to content

Conversation

@maloel
Copy link
Contributor

@maloel maloel commented Apr 19, 2023

Standardize abort_on_fail to on_fail across the board, with more options:

  • You can now stop a test with RAISE if a check fails
    • it raises a test.CheckFailed exception
    • this is automatically caught by test.closure and translated to a closure-specific on_fail (so a check fails, raised, caught, and the closure decides whether to just log, or abort, re-raise, etc.)
  • Default to LOG, same as before
  • Can abort like before with ABORT

@maloel maloel requested a review from OhadMeir April 19, 2023 09:53

class Error( RuntimeError ):
"""
Raised when an exception is raised on the remote side, unexpectedly so not the same as CheckFailed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is not clear. What is the remote side and is it enforced that it will raise Error and not some other type (RuntimeError or CheckFailed...)

if on_fail == ABORT:
abort()
if on_fail == RAISE:
raise CheckFailed( f'on_fail=RAISE' )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we supply a more informative message?

device = wait_for_devices( context, only_sw_devices, n=1. )[0]
sensors = device.sensors
test.check_equal( len(sensors), 1, abort_if_failed=True )
test.check_equal( len(sensors), 1, on_fail=test.RAISE )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who will catch this? How is it different from aborting?

Copy link
Contributor

@OhadMeir OhadMeir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discussion, all issues are clear and OK

@maloel maloel merged commit 8839614 into realsenseai:dds Apr 24, 2023
@maloel maloel deleted the on-fail branch April 24, 2023 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants