summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2016-06-27 01:22:03 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2016-06-27 01:22:03 -0700
commita15aee5d8e7bcdd37d9ee25fcf6ded449ef305d5 (patch)
tree68599c405e7f80822c0aa5b9144063f20e64b124
parent3bc4a38b78549cf93b128c0bd7a489487361743b (diff)
downloadspack-a15aee5d8e7bcdd37d9ee25fcf6ded449ef305d5.tar.gz
spack-a15aee5d8e7bcdd37d9ee25fcf6ded449ef305d5.tar.bz2
spack-a15aee5d8e7bcdd37d9ee25fcf6ded449ef305d5.tar.xz
spack-a15aee5d8e7bcdd37d9ee25fcf6ded449ef305d5.zip
Make MockPackagesTest use a different module location.
- ensures anything tests create is blown away.
-rw-r--r--lib/spack/spack/modules.py6
-rw-r--r--lib/spack/spack/test/mock_packages_test.py11
-rw-r--r--lib/spack/spack/test/modules.py2
3 files changed, 12 insertions, 7 deletions
diff --git a/lib/spack/spack/modules.py b/lib/spack/spack/modules.py
index fb58be6ce0..ce46047fa3 100644
--- a/lib/spack/spack/modules.py
+++ b/lib/spack/spack/modules.py
@@ -454,7 +454,6 @@ class EnvModule(object):
class Dotkit(EnvModule):
name = 'dotkit'
- path = join_path(spack.share_path, "dotkit")
environment_modifications_formats = {
PrependPath: 'dk_alter {name} {value}\n',
@@ -467,7 +466,7 @@ class Dotkit(EnvModule):
@property
def file_name(self):
- return join_path(Dotkit.path, self.spec.architecture,
+ return join_path(spack.share_path, "dotkit", self.spec.architecture,
'%s.dk' % self.use_name)
@property
@@ -495,7 +494,6 @@ class Dotkit(EnvModule):
class TclModule(EnvModule):
name = 'tcl'
- path = join_path(spack.share_path, "modules")
environment_modifications_formats = {
PrependPath: 'prepend-path --delim "{delim}" {name} \"{value}\"\n',
@@ -516,7 +514,7 @@ class TclModule(EnvModule):
@property
def file_name(self):
- return join_path(TclModule.path, self.spec.architecture, self.use_name)
+ return join_path(spack.share_path, "modules", self.spec.architecture, self.use_name)
@property
def header(self):
diff --git a/lib/spack/spack/test/mock_packages_test.py b/lib/spack/spack/test/mock_packages_test.py
index a56bd8ebdc..0a7a342a82 100644
--- a/lib/spack/spack/test/mock_packages_test.py
+++ b/lib/spack/spack/test/mock_packages_test.py
@@ -56,7 +56,7 @@ compilers:
fc: None
modules: 'None'
- compiler:
- spec: gcc@4.5.0
+ spec: gcc@4.5.0
operating_system: {0}{1}
paths:
cc: /path/to/gcc
@@ -144,7 +144,7 @@ compilers:
fc: /path/to/gfortran
operating_system: elcapitan
spec: gcc@4.5.0
- modules: 'None'
+ modules: 'None'
- compiler:
spec: clang@3.3
operating_system: elcapitan
@@ -201,6 +201,10 @@ class MockPackagesTest(unittest.TestCase):
spack.config.ConfigScope('site', self.mock_site_config)
spack.config.ConfigScope('user', self.mock_user_config)
+ # Keep tests from interfering with the actual module path.
+ self.real_share_path = spack.share_path
+ spack.share_path = tempfile.mkdtemp()
+
# Store changes to the package's dependencies so we can
# restore later.
self.saved_deps = {}
@@ -235,6 +239,9 @@ class MockPackagesTest(unittest.TestCase):
pkg.dependencies.clear()
pkg.dependencies.update(deps)
+ shutil.rmtree(spack.share_path, ignore_errors=True)
+ spack.share_path = self.real_share_path
+
def setUp(self):
self.initmock()
diff --git a/lib/spack/spack/test/modules.py b/lib/spack/spack/test/modules.py
index 443e4d13a6..6d2e3705bd 100644
--- a/lib/spack/spack/test/modules.py
+++ b/lib/spack/spack/test/modules.py
@@ -148,7 +148,7 @@ configuration_suffix = {
}
-class HelperFunctionsTests(unittest.TestCase):
+class HelperFunctionsTests(MockPackagesTest):
def test_update_dictionary_extending_list(self):
target = {