summaryrefslogtreecommitdiff
path: root/share/spack/qa/setup-env-test.fish
diff options
context:
space:
mode:
authorHarmen Stoppels <me@harmenstoppels.nl>2023-11-06 07:53:26 +0100
committerGitHub <noreply@github.com>2023-11-05 22:53:26 -0800
commit3c641c85097cef24cbea238f2254ced90f57bd2c (patch)
tree44849b19551b4d1ff6cd6a8f0a0f9627c706e2ec /share/spack/qa/setup-env-test.fish
parent141c7de5d89f32b203438e1d6fca1efd817299f7 (diff)
downloadspack-3c641c85097cef24cbea238f2254ced90f57bd2c.tar.gz
spack-3c641c85097cef24cbea238f2254ced90f57bd2c.tar.bz2
spack-3c641c85097cef24cbea238f2254ced90f57bd2c.tar.xz
spack-3c641c85097cef24cbea238f2254ced90f57bd2c.zip
spack env activate: create & activate default environment without args (#40756)
This PR implements the concept of "default environment", which doesn't have to be created explicitly. The aim is to lower the barrier for adopting environments. To (create and) activate the default environment, run ``` $ spack env activate ``` This mimics the behavior of ``` $ cd ``` which brings you to your home directory. This is not a breaking change, since `spack env activate` without arguments currently errors. It is similar to the already existing `spack env activate --temp` command which always creates an env in a temporary directory, the difference is that the default environment is a managed / named environment named `default`. The name `default` is not a reserved name, it's just that `spack env activate` creates it for you if you don't have it already. With this change, you can get started with environments faster: ``` $ spack env activate [--prompt] $ spack install --add x y z ``` instead of ``` $ spack env create default ==> Created environment 'default in /Users/harmenstoppels/spack/var/spack/environments/default ==> You can activate this environment with: ==> spack env activate default $ spack env activate [--prompt] default $ spack install --add x y z ``` Notice that Spack supports switching (but not stacking) environments, so the parallel with `cd` is pretty clear: ``` $ spack env activate named_env $ spack env status ==> In environment named_env $ spack env activate $ spack env status ==> In environment default ```
Diffstat (limited to 'share/spack/qa/setup-env-test.fish')
-rwxr-xr-xshare/spack/qa/setup-env-test.fish6
1 files changed, 5 insertions, 1 deletions
diff --git a/share/spack/qa/setup-env-test.fish b/share/spack/qa/setup-env-test.fish
index 6474917b70..589f4cbfa8 100755
--- a/share/spack/qa/setup-env-test.fish
+++ b/share/spack/qa/setup-env-test.fish
@@ -371,7 +371,6 @@ spt_contains " spack env list " spack env list --help
title 'Testing `spack env activate`'
spt_contains "No such environment:" spack env activate no_such_environment
-spt_contains "env activate requires an environment " spack env activate
spt_contains "usage: spack env activate " spack env activate -h
spt_contains "usage: spack env activate " spack env activate --help
@@ -415,6 +414,11 @@ spt_contains 'spack_test_2_env' 'fish' '-c' 'echo $PATH'
spt_does_not_contain 'spack_test_env' 'fish' '-c' 'echo $PATH'
despacktivate
+echo "Testing default environment"
+spack env activate
+contains "In environment default" spack env status
+despacktivate
+
echo "Correct error exit codes for activate and deactivate"
spt_fails spack env activate nonexisiting_environment
spt_fails spack env deactivate