File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -444,9 +444,10 @@ def parse_args(argv=None):
444444
445445 argv_ = argv if argv is not None else sys .argv [1 :]
446446 # Add special argparse handling for passthrough to genai-perf CLI
447- if argv_ [0 ] == "profile" :
447+ if len ( argv_ ) > 1 and argv_ [0 ] == "profile" :
448448 args , unknown_args = parser .parse_known_args (argv_ )
449449 args = add_unknown_args_to_args (args , unknown_args )
450450 else :
451451 args = parser .parse_args (argv_ )
452+
452453 return args
Original file line number Diff line number Diff line change 4949
5050
5151class TestRepo :
52+ def test_noargs (self ):
53+ # Test that running 'triton' with no args will fail with a parsing error
54+ # NOTE: pytest needs to be run with `--capture=sys` to read the output,
55+ # so just assert the error code and exception type for now.
56+ args = []
57+ with pytest .raises (SystemExit ) as excinfo :
58+ TritonCommands ._run_and_capture_stdout (args )
59+
60+ # argparse returns code 2 for error / missing arguments
61+ assert excinfo .value .code == 2
62+
5263 @pytest .mark .parametrize ("repo" , TEST_REPOS )
5364 def test_clear (self , repo ):
5465 TritonCommands ._clear (repo )
You can’t perform that action at this time.
0 commit comments