def print_step_ran(step): if step.subsequent_outline: return if step.scenario and step.scenario.outlines and (step.failed or step.passed or step.defined_at): return if step.hashes and step.defined_at: write_out("\033[A" * (len(step.hashes) + 1)) string = step.represent_string(step.original_sentence) if not step.failed: string = wrap_file_and_line(string, '\033[1;30m', '\033[0m') prefix = '\033[A' width, height = terminal.get_size() lines_up = len(string) / float(width) if lines_up < 1: lines_up = 1 else: lines_up = int(lines_up) + 1 #prefix = prefix * lines_up if step.failed: color = "\033[0;31m" string = wrap_file_and_line(string, '\033[1;41;33m', '\033[0m') elif step.passed: color = "\033[1;32m" elif step.defined_at: color = "\033[0;36m" else: color = "\033[0;33m" prefix = "" write_out("%s%s%s" % (prefix, color, string)) if step.hashes: for line in step.represent_hashes().splitlines(): write_out("%s%s\033[0m\n" % (color, line)) if step.failed: wrt("\033[1;31m") pspaced = lambda x: wrt("%s%s" % (" " * step.indentation, x)) lines = step.why.traceback.splitlines() for pindex, line in enumerate(lines): pspaced(line) if pindex + 1 < len(lines): wrt("\n") wrt("\033[0m\n")
def print_step_ran(step): if not step.display: return if step.scenario and step.scenario.outlines and (step.failed or step.passed or step.defined_at): return if step.hashes and step.defined_at: write_out("\033[A" * (len(step.hashes) + 1)) string = step.represent_string(step.original_sentence) if not step.failed: string = wrap_file_and_line(string, '\033[1;30m', '\033[0m') prefix = '\033[A' width, height = terminal.get_size() lines_up = len(string) / float(width) if lines_up < 1: lines_up = 1 else: lines_up = int(lines_up) + 1 #prefix = prefix * lines_up if step.failed: color = "\033[0;31m" string = wrap_file_and_line(string, '\033[1;41;33m', '\033[0m') elif step.passed: color = "\033[1;32m" elif step.defined_at: color = "\033[0;36m" else: color = "\033[0;33m" prefix = "" write_out("%s%s%s" % (prefix, color, string)) if step.hashes: for line in step.represent_hashes().splitlines(): write_out("%s%s\033[0m\n" % (color, line)) if step.failed: wrt("\033[1;31m") pspaced = lambda x: wrt("%s%s" % (" " * step.indentation, x)) lines = step.why.traceback.splitlines() for pindex, line in enumerate(lines): pspaced(line) if pindex + 1 < len(lines): wrt("\n") wrt("\033[0m\n")