Fix failing shell tests

This commit is contained in:
Philip Sakievich 2022-10-11 22:18:43 -06:00
parent b1bd61321d
commit 9984c838c8

View File

@ -65,6 +65,10 @@
#: default path where environments are stored in the spack tree
default_env_path = os.path.join(spack.paths.var_path, "environments")
# ensure that this base directory exists since we require the root directory to be created
# in our checks
os.makedirs(default_env_path, exist_ok = True)
#: Name of the input yaml file for an environment
manifest_name = "spack.yaml"
@ -250,6 +254,8 @@ def create(name, init_file=None, with_view=None, keep_relative=False):
"""Create a named environment in Spack."""
if not os.path.isdir(env_root_path()):
# double check that the root path exists before we check the full environment name
# we need to be a bit more pedantic and not create automatically since this is a user
# configurable path that can be subject to user input errors
raise SpackEnvironmentError(
"The environments_root '{er}' does not exist. Please create the directory or provide "
"a valid path in the config.yaml".format(er=env_root_path())