MCPcopy Create free account
hub / github.com/bigdra50/unity-cli / print_test_results_table

Function print_test_results_table

unity_cli/cli/output.py:539–567  ·  view source on GitHub ↗

Print test results as a formatted table.

(results: list[dict[str, Any]])

Source from the content-addressed store, hash-verified

537
538
539def print_test_results_table(results: list[dict[str, Any]]) -> None:
540 """Print test results as a formatted table."""
541 if not results:
542 print_line("No test results")
543 return
544
545 counts = {s: sum(1 for r in results if r.get("result") == s) for s in ("Passed", "Failed", "Skipped")}
546 title = f"Test Results (Passed: {counts['Passed']}, Failed: {counts['Failed']}, Skipped: {counts['Skipped']})"
547
548 if console.no_color:
549 rows = [
550 [t.get("name", "Unknown"), t.get("result", "Unknown"), _format_duration(t.get("duration", 0))]
551 for t in results
552 ]
553 _print_plain_table(["Test", "Result", "Duration"], rows, title)
554 return
555
556 table = Table(title=title)
557 table.add_column("Test", style="cyan", overflow="fold")
558 table.add_column("Result", justify="center")
559 table.add_column("Duration", justify="right")
560 for test in results:
561 result = test.get("result", "Unknown")
562 table.add_row(
563 escape(test.get("name", "Unknown")),
564 Text(escape(result), style=_TEST_RESULT_STYLES.get(result, "dim")),
565 _format_duration(test.get("duration", 0)),
566 )
567 console.print(table)
568
569
570def print_key_value(data: dict[str, Any], title: str | None = None) -> None:

Callers 1

tests_runFunction · 0.90

Calls 3

print_lineFunction · 0.85
_format_durationFunction · 0.85
getMethod · 0.45

Tested by 1

tests_runFunction · 0.72