Extract a human-readable test name from a command
(command: str | list[str])
| 772 | |
| 773 | |
| 774 | def _extract_test_name(command: str | list[str]) -> str: |
| 775 | """Extract a human-readable test name from a command""" |
| 776 | if isinstance(command, list): |
| 777 | command = " ".join(command) |
| 778 | |
| 779 | # Extract test name patterns |
| 780 | if "--test " in command: |
| 781 | # Extract specific test name after --test flag |
| 782 | parts = command.split("--test ") |
| 783 | if len(parts) > 1: |
| 784 | test_name = parts[1].split()[0] |
| 785 | return test_name |
| 786 | elif ".exe" in command: |
| 787 | # Extract from executable name |
| 788 | for part in command.split(): |
| 789 | if part.endswith(".exe"): |
| 790 | return part.replace(".exe", "") |
| 791 | elif "python" in command and "-m " in command: |
| 792 | # Extract module name |
| 793 | parts = command.split("-m ") |
| 794 | if len(parts) > 1: |
| 795 | module = parts[1].split()[0] |
| 796 | return module.replace("ci.compiler.", "").replace("ci.", "") |
| 797 | elif "python" in command and command.endswith(".py"): |
| 798 | # Extract script name |
| 799 | for part in command.split(): |
| 800 | if part.endswith(".py"): |
| 801 | return part.split("/")[-1].replace(".py", "") |
| 802 | |
| 803 | # Fallback to first meaningful part of command |
| 804 | parts = command.split() |
| 805 | for part in parts[1:]: # Skip 'uv' or 'python' |
| 806 | if not part.startswith("-") and "python" not in part: |
| 807 | return part |
| 808 | |
| 809 | return "unknown_test" |
| 810 | |
| 811 | |
| 812 | def _create_skipped_timing( |
no outgoing calls
no test coverage detected