diff options
Diffstat (limited to 'lib/spack/spack/test/cmd/install.py')
-rw-r--r-- | lib/spack/spack/test/cmd/install.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/spack/spack/test/cmd/install.py b/lib/spack/spack/test/cmd/install.py index e4df22a6a5..9ffd166e37 100644 --- a/lib/spack/spack/test/cmd/install.py +++ b/lib/spack/spack/test/cmd/install.py @@ -746,3 +746,27 @@ def test_compiler_bootstrap_already_installed( # Test succeeds if it does not raise an error install('gcc@2.0') install('a%gcc@2.0') + + +def test_install_fails_no_args(tmpdir): + # ensure no spack.yaml in directory + with tmpdir.as_cwd(): + output = install(fail_on_error=False) + + # check we got the short version of the error message with no spack.yaml + assert 'requires a package argument or active environment' in output + assert 'spack env activate .' not in output + assert 'using the `spack.yaml` in this directory' not in output + + +def test_install_fails_no_args_suggests_env_activation(tmpdir): + # ensure spack.yaml in directory + tmpdir.ensure('spack.yaml') + + with tmpdir.as_cwd(): + output = install(fail_on_error=False) + + # check we got the long version of the error message with spack.yaml + assert 'requires a package argument or active environment' in output + assert 'spack env activate .' in output + assert 'using the `spack.yaml` in this directory' in output |