summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2015-12-27 21:13:18 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2015-12-27 21:13:18 -0800
commitff0d871612c05d803fdabb8a5b870b7af961cdc2 (patch)
treee6d4127be24d6187b9f7504f30e1ba33091fbd2e
parent39e360f93a374314c28716ded3b1533d66cd62be (diff)
downloadspack-ff0d871612c05d803fdabb8a5b870b7af961cdc2.tar.gz
spack-ff0d871612c05d803fdabb8a5b870b7af961cdc2.tar.bz2
spack-ff0d871612c05d803fdabb8a5b870b7af961cdc2.tar.xz
spack-ff0d871612c05d803fdabb8a5b870b7af961cdc2.zip
Remove mock_configs; tests no longer modify spack home directory.
-rw-r--r--lib/spack/spack/__init__.py4
-rw-r--r--lib/spack/spack/test/mock_packages_test.py32
-rw-r--r--var/spack/mock_configs/site_spackconfig/compilers.yaml12
3 files changed, 30 insertions, 18 deletions
diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py
index de1a98d092..973ba64b96 100644
--- a/lib/spack/spack/__init__.py
+++ b/lib/spack/spack/__init__.py
@@ -78,10 +78,6 @@ installed_db = Database(install_path)
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.
diff --git a/lib/spack/spack/test/mock_packages_test.py b/lib/spack/spack/test/mock_packages_test.py
index 320c2921b0..7642edcf4b 100644
--- a/lib/spack/spack/test/mock_packages_test.py
+++ b/lib/spack/spack/test/mock_packages_test.py
@@ -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 @@ class MockPackagesTest(unittest.TestCase):
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.
diff --git a/var/spack/mock_configs/site_spackconfig/compilers.yaml b/var/spack/mock_configs/site_spackconfig/compilers.yaml
deleted file mode 100644
index 0a2dc893e2..0000000000
--- a/var/spack/mock_configs/site_spackconfig/compilers.yaml
+++ /dev/null
@@ -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