Skip to content

Commit 8d2020f

Browse files
committed
Add duration, platform and version information to test results data structure.
1 parent 30d84de commit 8d2020f

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

main.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,11 @@
8484
# in "skipped".
8585
for test_run, result in actual_results.items(): # result_all, result_module, etc.
8686
for test_status, matching_tests in result.items(): # passes, fails, skipped
87-
for test in matching_tests:
88-
assert test["test_name"].endswith(
89-
test_status
90-
), f"Test {test["test_name"]} does not end with {test_status}"
87+
if test_status in ["passes", "fails", "skipped"]:
88+
for test in matching_tests:
89+
assert test["test_name"].endswith(
90+
test_status
91+
), f"Test {test["test_name"]} does not end with {test_status}"
9192

9293
# Create a div to display the results in the page.
9394
page.append(

upytest.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,14 +513,17 @@ async def run(*args, **kwargs):
513513
error_count = len(failed_tests)
514514
skip_count = len(skipped_tests)
515515
pass_count = test_count - error_count - skip_count
516-
dur = end - start
516+
duration = end - start
517517
print(
518518
"========================= short test summary info =========================="
519519
)
520520
print(
521-
f"\033[1m{error_count}\033[0m \033[31;1mfailed\033[0m, \033[1m{skip_count}\033[0m \033[33;1mskipped\033[0m, \033[1m{pass_count}\033[0m \033[32;1mpassed\033[0m in \033[1m{dur:.2f} seconds\033[0m"
521+
f"\033[1m{error_count}\033[0m \033[31;1mfailed\033[0m, \033[1m{skip_count}\033[0m \033[33;1mskipped\033[0m, \033[1m{pass_count}\033[0m \033[32;1mpassed\033[0m in \033[1m{duration:.2f} seconds\033[0m"
522522
)
523523
return {
524+
"duration": duration,
525+
"platform": sys.platform,
526+
"version": sys.version,
524527
"passes": [test.as_dict for test in passed_tests],
525528
"fails": [test.as_dict for test in failed_tests],
526529
"skipped": [test.as_dict for test in skipped_tests],

0 commit comments

Comments
 (0)