Skip to content

Commit

Permalink
PR IntelRealSense#8064 from Aseel: set-option unit-test fix & bug fix…
Browse files Browse the repository at this point in the history
… in test.info
  • Loading branch information
maloel authored Dec 24, 2020
2 parents e27697a + c21a88b commit 3406ed7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 2 additions & 0 deletions unit-tests/func/test-set-option.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def check_color_frame_drops(frame):
option_name = "Depth sensor - " + str(option)
test.info(option_name, new_value)
test.unexpected_exception()
test.abort()

for option in color_options:
try:
Expand All @@ -103,6 +104,7 @@ def check_color_frame_drops(frame):
option_name = "Color sensor - " + str(option)
test.info(option_name, new_value)
test.unexpected_exception()
test.abort()

test.finish()
#############################################################################################
Expand Down
8 changes: 2 additions & 6 deletions unit-tests/py/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,15 @@ def unreachable( abort_if_failed = False ):
"""
check(False, abort_if_failed)

def unexpected_exception( abort_if_failed = False ):
def unexpected_exception():
"""
Used to assert that an except block is not reached. It's different from unreachable because it expects
to be in an except block and prints the stack of the error and not the call-stack for this function
:param abort_if_failed: If True and this function is reached the test will be aborted
"""
global n_assertions
n_assertions += 1
traceback.print_exc( file = sys.stdout )
check_failed()
if abort_if_failed:
abort()
reset_info()

def check_equal_lists(result, expected, abort_if_failed = False):
"""
Expand Down Expand Up @@ -283,7 +279,7 @@ def reset_info(persistent = False):
test_info.clear()
else:
for name, information in test_info.items():
if information.persistent:
if not information.persistent:
test_info.pop(name)

def print_info():
Expand Down

0 comments on commit 3406ed7

Please sign in to comment.