def print_col(line): print(colorize(line, fg=color))
filename = test["@classname"].replace('.', '/') + '.py' test_name = test['@name'] first_error = [] for line in text.split('\n'): if line.startswith('_ _ _ _'): break first_error.append(line) error_line = next(n for (n, line) in enumerate(first_error) if line.startswith('>')) N = 3 cmin = max(0, error_line - N) cmax = error_line + N first_error_context = first_error[cmin:cmax] lineno = first_error[-1].split(':')[-2] print('-' * 80) print(colorize(f'FAIL: ', fg='yellow', bold=True), end='') print(colorize(f'{filename}:{lineno}', fg='red'), end='') print(' in ', end='') print(colorize(test_name, fg='red', bold=True)) print() print('\n'.join(first_error_context)) print() print(colorize('EDIT:', fg='green'), ) print(f' $EDITOR +{lineno} {filename}') print('-' * 80)
def config_print(field, value): print(colorize(field + ":", bold=True), value)