mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
Add --details option
- extracts and prints affected tests Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
parent
06e3df1d82
commit
4a0ab1236d
2 changed files with 34 additions and 0 deletions
|
@ -31,6 +31,7 @@
|
||||||
(thanks to Scott Mcdermott)
|
(thanks to Scott Mcdermott)
|
||||||
- #512 help.t fails on alpine with mandoc package
|
- #512 help.t fails on alpine with mandoc package
|
||||||
(thanks to Edd Salkield)
|
(thanks to Edd Salkield)
|
||||||
|
- Add option '--details' to 'test/problems' script
|
||||||
|
|
||||||
------ current release ---------------------------
|
------ current release ---------------------------
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@ def parse_args():
|
||||||
parser = argparse.ArgumentParser(description="Report on test results")
|
parser = argparse.ArgumentParser(description="Report on test results")
|
||||||
parser.add_argument('--summary', action="store_true",
|
parser.add_argument('--summary', action="store_true",
|
||||||
help="Display only the totals in each category")
|
help="Display only the totals in each category")
|
||||||
|
parser.add_argument('--details', action="store_true",
|
||||||
|
help="Display details in each category")
|
||||||
parser.add_argument('tapfile', default="all.log", nargs="?",
|
parser.add_argument('tapfile', default="all.log", nargs="?",
|
||||||
help="File containing TAP output")
|
help="File containing TAP output")
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
@ -38,6 +40,13 @@ def print_category(tests):
|
||||||
print("%-32s %4d" % (key, tests[key]))
|
print("%-32s %4d" % (key, tests[key]))
|
||||||
|
|
||||||
|
|
||||||
|
def print_category_with_details(tests, details):
|
||||||
|
if not cmd_args.summary:
|
||||||
|
for key in sorted(tests):
|
||||||
|
print("%s (%d):" % (key, tests[key]))
|
||||||
|
print(details[key])
|
||||||
|
|
||||||
|
|
||||||
def pad(i):
|
def pad(i):
|
||||||
return " " * i
|
return " " * i
|
||||||
|
|
||||||
|
@ -46,12 +55,18 @@ if __name__ == "__main__":
|
||||||
cmd_args = parse_args()
|
cmd_args = parse_args()
|
||||||
|
|
||||||
errors = defaultdict(int)
|
errors = defaultdict(int)
|
||||||
|
details_errors = defaultdict(str)
|
||||||
skipped = defaultdict(int)
|
skipped = defaultdict(int)
|
||||||
|
details_skipped = defaultdict(str)
|
||||||
expected = defaultdict(int)
|
expected = defaultdict(int)
|
||||||
|
details_expected = defaultdict(str)
|
||||||
unexpected = defaultdict(int)
|
unexpected = defaultdict(int)
|
||||||
|
details_unexpected = defaultdict(str)
|
||||||
passed = defaultdict(int)
|
passed = defaultdict(int)
|
||||||
|
details_passed = defaultdict(str)
|
||||||
|
|
||||||
file = re.compile(r"^# (?:./)?(\S+\.t)(?:\.exe)?$")
|
file = re.compile(r"^# (?:./)?(\S+\.t)(?:\.exe)?$")
|
||||||
|
detail = re.compile("^[^:]+?: (.+)$")
|
||||||
timestamp = re.compile(r"^# (\d+(?:\.\d+)?) ==>.*$")
|
timestamp = re.compile(r"^# (\d+(?:\.\d+)?) ==>.*$")
|
||||||
|
|
||||||
expected_fail = re.compile(r"^not ok.*?#\s*TODO", re.I)
|
expected_fail = re.compile(r"^not ok.*?#\s*TODO", re.I)
|
||||||
|
@ -97,18 +112,21 @@ if __name__ == "__main__":
|
||||||
match = expected_fail.match(line)
|
match = expected_fail.match(line)
|
||||||
if match:
|
if match:
|
||||||
expected[filename] += 1
|
expected[filename] += 1
|
||||||
|
details_expected[filename] += line
|
||||||
expected_test_count -= 1
|
expected_test_count -= 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
match = unexpected_pass.match(line)
|
match = unexpected_pass.match(line)
|
||||||
if match:
|
if match:
|
||||||
unexpected[filename] += 1
|
unexpected[filename] += 1
|
||||||
|
details_unexpected[filename] += line
|
||||||
expected_test_count -= 1
|
expected_test_count -= 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
match = skip.match(line)
|
match = skip.match(line)
|
||||||
if match:
|
if match:
|
||||||
skipped[filename] += 1
|
skipped[filename] += 1
|
||||||
|
details_skipped[filename] += line
|
||||||
expected_test_count -= 1
|
expected_test_count -= 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -117,12 +135,14 @@ if __name__ == "__main__":
|
||||||
match = ok.match(line)
|
match = ok.match(line)
|
||||||
if match:
|
if match:
|
||||||
passed[filename] += 1
|
passed[filename] += 1
|
||||||
|
details_passed[filename] += line
|
||||||
expected_test_count -= 1
|
expected_test_count -= 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
match = not_ok.match(line)
|
match = not_ok.match(line)
|
||||||
if match:
|
if match:
|
||||||
errors[filename] += 1
|
errors[filename] += 1
|
||||||
|
details_errors[filename] += " - " + detail.match(line).group(1) + "\n"
|
||||||
expected_test_count -= 1
|
expected_test_count -= 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -158,6 +178,19 @@ if __name__ == "__main__":
|
||||||
print(color(expected_str, "yellow"), expected_int)
|
print(color(expected_str, "yellow"), expected_int)
|
||||||
print(runtime_str, runtime_int)
|
print(runtime_str, runtime_int)
|
||||||
|
|
||||||
|
elif cmd_args.details:
|
||||||
|
print(color(error_str, "red"))
|
||||||
|
print_category_with_details(errors, details_errors)
|
||||||
|
print()
|
||||||
|
print(color(unexpected_str, "red"))
|
||||||
|
print_category_with_details(unexpected, details_unexpected)
|
||||||
|
print()
|
||||||
|
print(color(skipped_str, "yellow"))
|
||||||
|
print_category_with_details(skipped, details_skipped)
|
||||||
|
print()
|
||||||
|
print(color(expected_str, "yellow"))
|
||||||
|
print_category_with_details(expected, details_expected)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print(color(error_str, "red"))
|
print(color(error_str, "red"))
|
||||||
print_category(errors)
|
print_category(errors)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue