summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2014-06-22 10:06:50 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2014-06-22 12:50:35 -0700
commitc091c6d4123a08f35e5a1c270806df190bb18ce9 (patch)
tree0b892d37ab1c7eedc7642c89bc4d1f6c1615cf3d /lib
parentc256d5d1ac15a5c04788461c646e3350a7882b5e (diff)
downloadspack-c091c6d4123a08f35e5a1c270806df190bb18ce9.tar.gz
spack-c091c6d4123a08f35e5a1c270806df190bb18ce9.tar.bz2
spack-c091c6d4123a08f35e5a1c270806df190bb18ce9.tar.xz
spack-c091c6d4123a08f35e5a1c270806df190bb18ce9.zip
Make tests use mock compiler configuration.
- makes sure tests don't fail on systems that don't have some compilers (e.g. clang). - more control over specific test cases for compilers.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/__init__.py6
-rw-r--r--lib/spack/spack/test/mock_packages_test.py9
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py
index 6046663ea8..287f2f862c 100644
--- a/lib/spack/spack/__init__.py
+++ b/lib/spack/spack/__init__.py
@@ -64,10 +64,14 @@ packages_path = join_path(var_path, "packages")
db = PackageDB(packages_path)
#
-# This is the path to mock packages used by spack for testing.
+# Paths to mock files for testing.
#
mock_packages_path = join_path(var_path, "mock_packages")
+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 e9a8113c09..adde70ff6c 100644
--- a/lib/spack/spack/test/mock_packages_test.py
+++ b/lib/spack/spack/test/mock_packages_test.py
@@ -25,9 +25,11 @@
import unittest
import spack
+import spack.config
from spack.packages import PackageDB
from spack.spec import Spec
+
def set_pkg_dep(pkg, spec):
"""Alters dependence information for a pacakge.
Use this to mock up constraints.
@@ -45,9 +47,14 @@ class MockPackagesTest(unittest.TestCase):
self.real_db = spack.db
spack.db = PackageDB(spack.mock_packages_path)
+ self.real_scopes = spack.config._scopes
+ spack.config._scopes = {
+ 'site' : spack.mock_site_config,
+ 'user' : spack.mock_user_config }
@classmethod
def tearDown(self):
"""Restore the real packages path after any test."""
- #restore_dependencies()
spack.db = self.real_db
+ spack.config._scopes = self.real_scopes
+