test(cli): cover UsageError path in main() and drop redundant handler
The mro-based UsageError check inside the Exception block already catches BadParameter (it inherits from UsageError) — the separate typer.BadParameter handler was redundant. Added an in-process Behave step that calls main() directly and captures err_console output, plus a scenario that runs `plan use --no-such-flag` to cover the UsageError branch (subprocess steps do not count toward unit-test coverage).
This commit is contained in:
@@ -35,3 +35,9 @@ Feature: CLI main() error handling paths
|
||||
Scenario: _print_basic_help prints without error
|
||||
When I call the main _print_basic_help
|
||||
Then the main _print_basic_help completes ok
|
||||
|
||||
@coverage
|
||||
Scenario: unknown option triggers UsageError handler with exit code 2
|
||||
When I call main with arguments ["plan", "use", "--no-such-flag", "x"]
|
||||
Then the main cli exit code should be 2
|
||||
And the main cli output contains "No such option"
|
||||
|
||||
Reference in New Issue
Block a user