Remove mock_configs; tests no longer modify spack home directory.
This commit is contained in:
parent
39e360f93a
commit
ff0d871612
@ -78,10 +78,6 @@
|
||||
packages_path = join_path(repos_path, "builtin")
|
||||
mock_packages_path = join_path(repos_path, "builtin.mock")
|
||||
|
||||
mock_config_path = join_path(var_path, "mock_configs")
|
||||
mock_site_config = join_path(mock_config_path, "site_spackconfig")
|
||||
mock_user_config = join_path(mock_config_path, "user_spackconfig")
|
||||
|
||||
#
|
||||
# This controls how spack lays out install prefixes and
|
||||
# stage directories.
|
||||
|
@ -23,14 +23,32 @@
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
import sys
|
||||
import os
|
||||
import unittest
|
||||
import tempfile
|
||||
from ordereddict_backport import OrderedDict
|
||||
|
||||
from llnl.util.filesystem import mkdirp
|
||||
|
||||
import spack
|
||||
import spack.config
|
||||
from spack.repository import RepoPath
|
||||
from spack.spec import Spec
|
||||
|
||||
mock_compiler_config = """\
|
||||
compilers:
|
||||
all:
|
||||
clang@3.3:
|
||||
cc: /path/to/clang
|
||||
cxx: /path/to/clang++
|
||||
f77: None
|
||||
fc: None
|
||||
gcc@4.5.0:
|
||||
cc: /path/to/gcc
|
||||
cxx: /path/to/g++
|
||||
f77: /path/to/gfortran
|
||||
fc: /path/to/gfortran
|
||||
"""
|
||||
|
||||
class MockPackagesTest(unittest.TestCase):
|
||||
def initmock(self):
|
||||
@ -43,11 +61,21 @@ def initmock(self):
|
||||
spack.config.clear_config_caches()
|
||||
self.real_scopes = spack.config.config_scopes
|
||||
|
||||
# Mock up temporary configuration directories
|
||||
self.temp_config = tempfile.mkdtemp()
|
||||
self.mock_site_config = os.path.join(self.temp_config, 'site')
|
||||
self.mock_user_config = os.path.join(self.temp_config, 'user')
|
||||
mkdirp(self.mock_site_config)
|
||||
mkdirp(self.mock_user_config)
|
||||
comp_yaml = os.path.join(self.mock_site_config, 'compilers.yaml')
|
||||
with open(comp_yaml, 'w') as f:
|
||||
f.write(mock_compiler_config)
|
||||
|
||||
# TODO: Mocking this up is kind of brittle b/c ConfigScope
|
||||
# TODO: constructor modifies config_scopes. Make it cleaner.
|
||||
spack.config.config_scopes = OrderedDict()
|
||||
spack.config.ConfigScope('site', spack.mock_site_config)
|
||||
spack.config.ConfigScope('user', spack.mock_user_config)
|
||||
spack.config.ConfigScope('site', self.mock_site_config)
|
||||
spack.config.ConfigScope('user', self.mock_user_config)
|
||||
|
||||
# Store changes to the package's dependencies so we can
|
||||
# restore later.
|
||||
|
@ -1,12 +0,0 @@
|
||||
compilers:
|
||||
all:
|
||||
clang@3.3:
|
||||
cc: /path/to/clang
|
||||
cxx: /path/to/clang++
|
||||
f77: None
|
||||
fc: None
|
||||
gcc@4.5.0:
|
||||
cc: /path/to/gcc
|
||||
cxx: /path/to/g++
|
||||
f77: /path/to/gfortran
|
||||
fc: /path/to/gfortran
|
Loading…
Reference in New Issue
Block a user