List all available tests (unit tests and examples). Args: filter_pattern: Optional pattern to filter test names filter_type: Optional filter type ("unit_test" or "example")
(
filter_pattern: str | None = None, filter_type: str | None = None
)
| 281 | |
| 282 | |
| 283 | def list_all_tests( |
| 284 | filter_pattern: str | None = None, filter_type: str | None = None |
| 285 | ) -> None: |
| 286 | """ |
| 287 | List all available tests (unit tests and examples). |
| 288 | |
| 289 | Args: |
| 290 | filter_pattern: Optional pattern to filter test names |
| 291 | filter_type: Optional filter type ("unit_test" or "example") |
| 292 | """ |
| 293 | from ci.util.smart_selector import discover_all_tests |
| 294 | |
| 295 | # Discover all available tests |
| 296 | unit_tests, examples = discover_all_tests() |
| 297 | |
| 298 | # Apply filters |
| 299 | if filter_pattern: |
| 300 | filter_pattern_lower = filter_pattern.lower() |
| 301 | unit_tests = [ |
| 302 | (name, path) |
| 303 | for name, path in unit_tests |
| 304 | if filter_pattern_lower in name.lower() |
| 305 | ] |
| 306 | examples = [ |
| 307 | (name, path) |
| 308 | for name, path in examples |
| 309 | if filter_pattern_lower in name.lower() |
| 310 | ] |
| 311 | |
| 312 | if filter_type == "unit_test": |
| 313 | examples = [] |
| 314 | elif filter_type == "example": |
| 315 | unit_tests = [] |
| 316 | |
| 317 | # Print results |
| 318 | _ts_print("Available tests:") |
| 319 | _ts_print("") |
| 320 | |
| 321 | if unit_tests: |
| 322 | _ts_print(f"Unit tests ({len(unit_tests)}):") |
| 323 | for name, path in sorted(unit_tests): |
| 324 | _ts_print(f" {name:30} ({path})") |
| 325 | _ts_print("") |
| 326 | |
| 327 | if examples: |
| 328 | _ts_print(f"Examples ({len(examples)}):") |
| 329 | for name, path in sorted(examples): |
| 330 | _ts_print(f" {name:30} ({path})") |
| 331 | _ts_print("") |
| 332 | |
| 333 | total = len(unit_tests) + len(examples) |
| 334 | _ts_print(f"Total: {total} tests") |
no test coverage detected