def print_test_result(test_result): values = { TestResult.PASSED: ('PASSED', ConsoleColor.FG_GREEN), TestResult.FAILED: ('FAILED', ConsoleColor.FG_RED), TestResult.TIMEOUT: ('TIMEOUT', ConsoleColor.FG_BLUE), TestResult.UNKNOWN_EXCEPTION: ('UNHANDLED EXCEPTION', ConsoleColor.FG_RED), TestResult.STACK_OVERFLOW: ('STACK OVERFLOW', ConsoleColor.FG_RED) } if test_result in values: print_std_out_colored(values[test_result][1], values[test_result][0]) else: raise RuntimeError('Unknown TestResult')
def print_failed_test(param_names, arguments, test_failure, res_printer): max_col_size = test_failure.get_max_property_name_length() for param in param_names: if len(param) > max_col_size: max_col_size = len(param) print_std_out_colored(ConsoleColor.FG_YELLOW, 'Arguments') print() for (name, value) in zip(param_names, arguments): print('\t', end='') print_std_out_colored(ConsoleColor.FG_YELLOW, name) print(': {}{}'.format(gen_spaces(max_col_size - len(name)), escape_newline(str(value)))) properties = test_failure.get_properties() print_std_out_colored(ConsoleColor.FG_YELLOW, '\nFailure info\n') for prop in properties: if res_printer is not None: value = res_printer(prop.raw_name(), prop.value()) else: value = prop.value() print('\t', end='') print_std_out_colored(ConsoleColor.FG_YELLOW, prop.name()) print(': {}{}'.format(gen_spaces(max_col_size - len(prop.name())), value))
def print_test_result(test_result): try: print_std_out_colored( *{ TestResult.PASSED: (ConsoleColor.FG_GREEN, 'PASSED'), TestResult.FAILED: (ConsoleColor.FG_RED, 'FAILED'), TestResult.TIMEOUT: (ConsoleColor.FG_BLUE, 'TIMEOUT'), TestResult.UNKNOWN_EXCEPTION: (ConsoleColor.FG_RED, 'UNHANDLED EXCEPTION'), TestResult.STACK_OVERFLOW: (ConsoleColor.FG_RED, 'STACK OVERFLOW') }[test_result]) except KeyError: raise RuntimeError('Unknown TestResult')
def print_failed_test(param_names, arguments, test_failure, res_printer): max_col_size = test_failure.get_max_property_name_length() for param in param_names: if len(param) > max_col_size: max_col_size = len(param) print_std_out_colored(ConsoleColor.FG_YELLOW, 'Arguments') print() for (name, value) in zip(param_names, arguments): print('\t', end='') print_std_out_colored(ConsoleColor.FG_YELLOW, name) print(': {}{}'.format( gen_spaces(max_col_size - len(name)), escape_newline(str(value)))) properties = test_failure.get_properties() print_std_out_colored(ConsoleColor.FG_YELLOW, '\nFailure info\n') for prop in properties: if res_printer is not None: value = res_printer(prop.raw_name(), prop.value()) else: value = prop.value() print('\t', end='') print_std_out_colored(ConsoleColor.FG_YELLOW, prop.name()) print(': {}{}'.format( gen_spaces(max_col_size - len(prop.name())), value))
def print_test_result(test_result): try: print_std_out_colored( *{ TestResult.PASSED: (ConsoleColor.FG_GREEN, "PASSED"), TestResult.FAILED: (ConsoleColor.FG_RED, "FAILED"), TestResult.TIMEOUT: (ConsoleColor.FG_BLUE, "TIMEOUT"), TestResult.UNKNOWN_EXCEPTION: ( ConsoleColor.FG_RED, "UNHANDLED EXCEPTION", ), TestResult.STACK_OVERFLOW: ( ConsoleColor.FG_RED, "STACK OVERFLOW", ), }[test_result]) except KeyError: raise RuntimeError("Unknown TestResult")
def print_test_result(test_result): if test_result in _print_test_result_values: print_std_out_colored(_print_test_result_values[test_result][1], _print_test_result_values[test_result][0]) else: raise RuntimeError('Unknown TestResult')
def print_test_result(test_result): if test_result in _print_test_result_values: print_std_out_colored(_print_test_result_values[test_result][1], _print_test_result_values[test_result][0]) else: raise RuntimeError('Unknown TestResult')