tests: make env tests that use configs non-destructive

Environment tests pushed config scopes but didn't properly remove them.

- [x] use `with env:` context manager instead of `env.prepare_config_scopes()`
This commit is contained in:
Todd Gamblin 2019-12-29 02:16:14 -08:00
parent 8e8235043d
commit e839432472

View file

@ -406,8 +406,8 @@ def test_env_with_config():
_env_create('test', StringIO(test_config))
e = ev.read('test')
ev.prepare_config_scope(e)
e.concretize()
with e:
e.concretize()
assert any(x.satisfies('mpileaks@2.2')
for x in e._get_environment_specs())
@ -431,8 +431,8 @@ def test_env_with_included_config_file():
version: [2.2]
""")
ev.prepare_config_scope(e)
e.concretize()
with e:
e.concretize()
assert any(x.satisfies('mpileaks@2.2')
for x in e._get_environment_specs())
@ -460,8 +460,8 @@ def test_env_with_included_config_scope():
version: [2.2]
""")
ev.prepare_config_scope(e)
e.concretize()
with e:
e.concretize()
assert any(x.satisfies('mpileaks@2.2')
for x in e._get_environment_specs())
@ -490,8 +490,8 @@ def test_env_config_precedence():
version: [0.8.11]
""")
ev.prepare_config_scope(e)
e.concretize()
with e:
e.concretize()
# ensure included scope took effect
assert any(
@ -530,8 +530,8 @@ def test_included_config_precedence():
version: [0.8.12]
""")
ev.prepare_config_scope(e)
e.concretize()
with e:
e.concretize()
assert any(
x.satisfies('mpileaks@2.2') for x in e._get_environment_specs())