Make MockPackagesTest use a different module location.
- ensures anything tests create is blown away.
This commit is contained in:
parent
3bc4a38b78
commit
a15aee5d8e
3 changed files with 12 additions and 7 deletions
|
@ -454,7 +454,6 @@ def remove(self):
|
|||
|
||||
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 @@ def prerequisite(self, spec):
|
|||
|
||||
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):
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
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 @@
|
|||
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 @@ def initmock(self):
|
|||
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 @@ def cleanmock(self):
|
|||
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()
|
||||
|
|
|
@ -148,7 +148,7 @@ def mock_open(filename, mode):
|
|||
}
|
||||
|
||||
|
||||
class HelperFunctionsTests(unittest.TestCase):
|
||||
class HelperFunctionsTests(MockPackagesTest):
|
||||
|
||||
def test_update_dictionary_extending_list(self):
|
||||
target = {
|
||||
|
|
Loading…
Reference in a new issue