summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/test/environment_modifications.py7
-rw-r--r--lib/spack/spack/util/environment.py2
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/spack/spack/test/environment_modifications.py b/lib/spack/spack/test/environment_modifications.py
index 4d2d179b10..a54d9d82aa 100644
--- a/lib/spack/spack/test/environment_modifications.py
+++ b/lib/spack/spack/test/environment_modifications.py
@@ -306,3 +306,10 @@ def test_preserve_environment(prepare_environment_for_tests):
assert 'NOT_SET' not in os.environ
assert os.environ['UNSET_ME'] == 'foo'
assert os.environ['PATH_LIST'] == '/path/second:/path/third'
+
+
+def test_clear(env):
+ env.set('A', 'dummy value')
+ assert len(env) > 0
+ env.clear()
+ assert len(env) == 0
diff --git a/lib/spack/spack/util/environment.py b/lib/spack/spack/util/environment.py
index 14e4c06501..c7ea4d67f4 100644
--- a/lib/spack/spack/util/environment.py
+++ b/lib/spack/spack/util/environment.py
@@ -353,7 +353,7 @@ class EnvironmentModifications(object):
"""
Clears the current list of modifications
"""
- self.env_modifications.clear()
+ self.env_modifications = []
def apply_modifications(self):
"""Applies the modifications and clears the list."""