diff options
-rw-r--r-- | lib/spack/spack/cmd/test.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/spack/spack/cmd/test.py b/lib/spack/spack/cmd/test.py index 2e0ab8b49e..9d92037bb6 100644 --- a/lib/spack/spack/cmd/test.py +++ b/lib/spack/spack/cmd/test.py @@ -99,9 +99,10 @@ def test(parser, args, unknown_args): do_list(args, unknown_args) return - if args.tests and not any(arg.startswith('-') for arg in args.tests): - # Allow keyword search without -k if no options are specified + # Allow keyword search without -k if no options are specified + if (args.tests and not unknown_args and + not any(arg.startswith('-') for arg in args.tests)): return pytest.main(['-k'] + args.tests) - else: - # Just run the pytest command. - return pytest.main(unknown_args + args.tests) + + # Just run the pytest command + return pytest.main(unknown_args + args.tests) |