def fail_if_not_equal(self, what, expected, actual): """Register a check failure when EXPECTED and ACTUAL are not equal.""" self.fail_if( expected != actual, 'Unexpected {}. Expected:' '\n{}' '\nBut got:' '\n{}'.format(what, indent(str(expected)), indent(str(actual))))
def fail_if_no_match(self, what, regexp, actual): """Register a check failure when ACTUAL does not match regexp.""" if isinstance(regexp, str): regexp = re.compile(regexp) self.fail_if( not regexp.match(actual), 'Unexpected {}. Expected:' '\n{}' '\nBut got:' '\n{}'.format(what, indent(regexp.pattern), indent(str(actual))))
def gprbuild_wrapper(root_project, gargs): # Honor build relevant switches from gprsw here gprbuild(root_project, gargs=gprsw.build_switches + gargs + extra_gprbuild_args, extracargs=extra_gprbuild_cargs, trace_mode=trace_mode) if check_gprbuild_output: gprbuild_out = contents_of('gprbuild.out') thistest.fail_if( gprbuild_out, "gprbuild's output (gprbuild.out) is not empty:\n{}" .format(indent(gprbuild_out)))