def _get_test_description(self, test_id): if test_id in self.testcases_by_id: desc = get_test_description(descriptions, self.testcases_by_id[test_id]) else: desc = test_id return desc
def print_results(self): print('') print(double_line_delim) print('TEST RESULTS:') print(' Executed tests: {}'.format(self.all_testcases)) print(' Passed tests: {}'.format( colorize(str(self.passed), GREEN))) if self[self.failures_id] > 0: print(' Failures: {}'.format( colorize(str(self[self.failures_id]), RED))) if self[self.errors_id] > 0: print(' Errors: {}'.format( colorize(str(self[self.errors_id]), RED))) if self[self.skipped_id] > 0: print(' Skipped tests: {}'.format( colorize(str(self[self.skipped_id]), YELLOW))) if self[self.expectedFailures_id] > 0: print(' Expected failures: {}'.format( colorize(str(self[self.expectedFailures_id]), GREEN))) if self[self.unexpectedSuccesses_id] > 0: print(' Unexpected successes: {}'.format( colorize(str(self[self.unexpectedSuccesses_id]), YELLOW))) if self.all_failed > 0: print('FAILED TESTS:') for testcase_class, suite_results in \ self.results_per_suite.items(): failed_testcases = suite_results[ self.failures_id] errored_testcases = suite_results[ self.errors_id] if len(failed_testcases) or len(errored_testcases): print(' Testcase name: {}'.format( colorize(testcase_class, RED))) for failed_test in failed_testcases: print(' FAILED: {}'.format( colorize(get_test_description( descriptions, failed_test), RED))) for failed_test in errored_testcases: print(' ERRORED: {}'.format( colorize(get_test_description( descriptions, failed_test), RED))) print(double_line_delim) print('')
def add_testclass_with_core(self): if self.last_test_id in self.testcases_by_id: test = self.testcases_by_id[self.last_test_id] class_name = unittest.util.strclass(test.__class__) test_name = "'{}' ({})".format( get_test_description(descriptions, test), self.last_test_id) else: test_name = self.last_test_id class_name = re.match( r'((tearDownClass)|(setUpClass)) ' r'\((.+\..+)\)', test_name).groups()[3] if class_name not in self.testclasess_with_core: self.testclasess_with_core[class_name] = ( test_name, self.last_test_vpp_binary, self.last_test_temp_dir)
def add_testclass_with_core(self): if self.last_test_id in self.testcases_by_id: test = self.testcases_by_id[self.last_test_id] class_name = unittest.util.strclass(test.__class__) test_name = "'{}' ({})".format(get_test_description(descriptions, test), self.last_test_id) else: test_name = self.last_test_id class_name = re.match(r'((tearDownClass)|(setUpClass)) ' r'\((.+\..+)\)', test_name).groups()[3] if class_name not in self.testclasess_with_core: self.testclasess_with_core[class_name] = ( test_name, self.last_test_vpp_binary, self.last_test_temp_dir)
def _get_test_description(self, test_id): return get_test_description(descriptions, self.testcases_by_id[test_id])