Why do we have mutliple cod paths for env activation?
This commit is contained in:
parent
d50c8f1727
commit
5aa7a564d3
@ -90,6 +90,15 @@ def env_root_path():
|
||||
)
|
||||
|
||||
|
||||
def check_disallowed_env_config_mods(scopes):
|
||||
for scope in scopes:
|
||||
with spack.config.override(scope):
|
||||
if spack.config.get("config:environments_root"):
|
||||
raise SpackEnvironmentError("Need a good message")
|
||||
else:
|
||||
spack.config.print_section("config")
|
||||
return scopes
|
||||
|
||||
def default_manifest_yaml():
|
||||
"""default spack.yaml file to put in new environments"""
|
||||
return """\
|
||||
@ -1039,17 +1048,9 @@ def env_file_config_scope(self):
|
||||
[spack.config.first_existing(self.raw_yaml, spack.schema.env.keys)],
|
||||
)
|
||||
|
||||
def _check_disallowed_env_config_mods(scopes):
|
||||
for scope in scopes:
|
||||
with spack.config.override(scope):
|
||||
if spack.config.get("config:environments_root"):
|
||||
raise SpackEnvironmentError("Need a good message")
|
||||
else:
|
||||
spack.config.print_section("config")
|
||||
|
||||
def config_scopes(self):
|
||||
"""A list of all configuration scopes for this environment."""
|
||||
return _check_disallowed_env_config_mods(
|
||||
return check_disallowed_env_config_mods(
|
||||
self.included_config_scopes() + [self.env_file_config_scope()]
|
||||
)
|
||||
|
||||
|
@ -1478,6 +1478,11 @@ def test_environment_cant_modify_environments_root(tmpdir):
|
||||
"""
|
||||
)
|
||||
with tmpdir.as_cwd():
|
||||
env("create", "-d", tmpdir.strpath)
|
||||
with pytest.raises(ev.SpackEnvironmentError):
|
||||
# Why does this raise?
|
||||
e = ev.Environment(tmpdir.strpath)
|
||||
ev.activate(e)
|
||||
with pytest.raises(ev.SpackEnvironmentError):
|
||||
# When this does not?
|
||||
env("create", "-d", tmpdir.strpath)
|
||||
env("activate", "-d", tmpdir.strpath)
|
||||
|
Loading…
Reference in New Issue
Block a user