def format_result(msg, no_colors=False): result = msg["result_type"] test_type = get_type(msg) _color = color_result(result, no_colors=no_colors) _result = _color(f"\u25b6 " + result, no_colors=no_colors) _test = color_test_name(basename(msg["result_test"]), no_colors=no_colors) _indent = "" out = f"{_result}" out += f", {_test}" if result in ("Fail", "Error", "Null"): if msg["result_message"]: out += color_test_name(",", no_colors=no_colors) out += f" {_color(format_multiline(msg['result_message'], _indent).lstrip(), no_colors=no_colors)}" elif result.startswith("X"): if msg["result_reason"]: out += color_test_name(",", no_colors=no_colors) out += f" {_color(msg['result_reason'], no_colors=no_colors)}" elif msg["result_message"]: out += color_test_name(",", no_colors=no_colors) out += f" {_color(format_multiline(msg['result_message'], _indent).lstrip(), no_colors=no_colors)}" out += "\n" if test_type > TestType.Step: out += f"{separators[test_type]}" return out
def title(self, results): if results["tests"]: title = basename(list(results["tests"].values())[0]["test"]["test_name"]) if title: title = make_title(title) return title return ""
def format_result(msg, prefix, result): if Flags(msg.p_flags) & SKIP and settings.show_skipped is False: return _result = color_result(prefix, result) _test = color_other(basename(msg.test)) _indent = indent * (msg.p_id.count('/') - 1) return (color_other(f"{strftimedelta(msg.p_time):>20}") + f"{'':3}{_indent}{_result} " f"{_test}{color_other(', ' + msg.test)}" f"{(color_other(', ') + color(format_multiline(msg.message, _indent + ' ' * 26).lstrip(), 'yellow', attrs=['bold'])) if msg.message else ''}" f"{(color_other(', ') + color(msg.reason, 'blue', attrs=['bold'])) if msg.reason else ''}\n")
def format_result(msg, prefix): result = msg["result_type"] _color = color_result(result) _result = _color(prefix + result) _test = color_other(basename(msg["result_test"])) _indent = f"{strftimedelta(msg['message_rtime']):>20}" + f"{'':3}{indent * (msg['test_id'].count('/') - 1)}" out = ( f"{color_other(_indent)}{_result} " f"{_test}{color_other(', ' + msg['result_test'])}" f"{(color_other(', ') + _color(format_multiline(msg['result_message'], ' ' * len(_indent)).strip())) if msg['result_message'] else ''}" f"{(color_other(', ') + _color(msg['result_reason'])) if msg['result_reason'] else ''}\n" ) return out
def format_result(msg, no_colors=False): result = msg["result_type"] _color = color_result(result, no_colors=no_colors) _result = _color(result, no_colors=no_colors) _test = color_test_name(basename(msg["result_test"]), no_colors=no_colors) _indent = indent * (msg["test_id"].count('/') - 1) out = f"{_indent}{_result}" if result in ("Fail", "Error", "Null"): out += f" {_test}" if msg["result_message"]: out += color_test_name(",", no_colors=no_colors) out += f" {_color(format_multiline(msg['result_message'], _indent).lstrip(), no_colors=no_colors)}" elif result.startswith("X"): out += f" {_test}" if msg["result_reason"]: out += color_test_name(",", no_colors=no_colors) out += f" {_color(msg['result_reason'], no_colors=no_colors)}" return out + "\n"
def test(self, results, test): t = {} t["path"] = test["test_name"] t["level"] = test["test_level"] t["keyword"] = test["test_type"] t["type"] = test["test_type"] t["subtype"] = test["test_subtype"] if test["test_subtype"]: t["keyword"] = test["test_subtype"] t["description"] = test["test_description"] t["attributes"] = test["attributes"] t["tags"] = test["tags"] t["requirements"] = test["requirements"] t["name"] = basename(test["test_name"]) t["id"] = test["test_id"] children = results["tests_by_parent"].get(test["test_id"]) t["steps"] = [] if children: for child in children: t["steps"].append(self.test(results, child)) return t
def format_result(msg, result): flags = Flags(msg.p_flags) if flags & SKIP and settings.show_skipped is False: return _result = color_result(result) _test = color_test_name(basename(msg.test)) _indent = indent * (msg.p_id.count('/') - 1) out = f"{_indent}{_result}" if msg.name in ("Fail", "Error", "Null"): out += f" {_test}" if msg.message: out += color_test_name(",") out += f" {color(format_multiline(msg.message, _indent).lstrip(), 'yellow', attrs=['bold'])}" elif msg.name.startswith("X"): out += f" {_test}" if msg.reason: out += color_test_name(",") out += f" {color(msg.reason, 'blue', attrs=['bold'])}" return out + "\n"