MCPcopy Create free account
hub / github.com/LBANN/lbann / assert_failure

Function assert_failure

ci_test/common_python/tools.py:678–693  ·  view source on GitHub ↗
(return_code, expected_error, error_file_name)

Source from the content-addressed store, hash-verified

676
677
678def assert_failure(return_code, expected_error, error_file_name):
679 if return_code == 0:
680 raise AssertionError(
681 'Success when expecting failure. return_code={rc}\nSee {efn}'.format(
682 rc=return_code, efn=error_file_name))
683 with open(error_file_name, 'r') as error_file:
684 for line in error_file:
685 if expected_error in line:
686 return True
687 # If we're at this point, then we know the test did not succeed,
688 # but we didn't get the expected error.
689 actual_error = get_error_line(error_file_name)
690 raise AssertionError(
691 'Failed with error different than expected: actual_error={ae}, expected_error={ee}\nreturn_code={rc}\nSee {efn}'.format(
692 rc=return_code, ae=actual_error, ee=expected_error,
693 efn=error_file_name))
694
695
696def create_tests(setup_func,

Callers

nothing calls this directly

Calls 1

get_error_lineFunction · 0.85

Tested by

no test coverage detected