Parse command line arguments
(args: Optional[list[str]] = None)
| 30 | |
| 31 | |
| 32 | def parse_args(args: Optional[list[str]] = None) -> TestArgs: |
| 33 | """Parse command line arguments""" |
| 34 | import argparse # noqa: PLC0415 - lazy: ~20ms saved on early-exit paths |
| 35 | |
| 36 | parser = argparse.ArgumentParser(description="Run FastLED tests") |
| 37 | parser.add_argument( |
| 38 | "--cpp", |
| 39 | action="store_true", |
| 40 | help="Run C++ tests only (equivalent to --unit --examples, suppresses Python tests)", |
| 41 | ) |
| 42 | parser.add_argument("--unit", action="store_true", help="Run C++ unit tests only") |
| 43 | parser.add_argument("--py", action="store_true", help="Run Python tests only") |
| 44 | parser.add_argument( |
| 45 | "test", |
| 46 | type=str, |
| 47 | nargs="*", |
| 48 | default=None, |
| 49 | help="Specific test to run (Python or C++). Multiple words can be provided for fuzzy matching (e.g., 'string interner')", |
| 50 | ) |
| 51 | |
| 52 | # Create mutually exclusive group for compiler selection |
| 53 | compiler_group = parser.add_mutually_exclusive_group() |
| 54 | compiler_group.add_argument( |
| 55 | "--clang", action="store_true", help="Use Clang compiler" |
| 56 | ) |
| 57 | compiler_group.add_argument( |
| 58 | "--gcc", action="store_true", help="Use GCC compiler (default on non-Windows)" |
| 59 | ) |
| 60 | |
| 61 | parser.add_argument( |
| 62 | "--clean", action="store_true", help="Clean build before compiling" |
| 63 | ) |
| 64 | parser.add_argument( |
| 65 | "--no-interactive", |
| 66 | action="store_true", |
| 67 | help="Force non-interactive mode (no confirmation prompts)", |
| 68 | ) |
| 69 | parser.add_argument( |
| 70 | "--interactive", |
| 71 | action="store_true", |
| 72 | help="Enable interactive mode (allows confirmation prompts)", |
| 73 | ) |
| 74 | parser.add_argument( |
| 75 | "--verbose", |
| 76 | "-v", |
| 77 | action="store_true", |
| 78 | help="Enable verbose output showing all test details", |
| 79 | ) |
| 80 | parser.add_argument( |
| 81 | "--show-compile", |
| 82 | action="store_true", |
| 83 | help="Show compilation commands and output", |
| 84 | ) |
| 85 | parser.add_argument( |
| 86 | "--show-link", |
| 87 | action="store_true", |
| 88 | help="Show linking commands and output", |
| 89 | ) |
no test coverage detected