summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2018-04-15 20:45:34 -0700
committerscheibelp <scheibel1@llnl.gov>2018-05-17 14:10:30 -0700
commit278933e824d6ef0b791ec088070b86ed3c1f03b5 (patch)
tree511e9eecf66888193a22fd4c9954735a30a267e7 /lib
parent77bd2dd706fee40e16ba5875cc195ed4b59d82cd (diff)
downloadspack-278933e824d6ef0b791ec088070b86ed3c1f03b5.tar.gz
spack-278933e824d6ef0b791ec088070b86ed3c1f03b5.tar.bz2
spack-278933e824d6ef0b791ec088070b86ed3c1f03b5.tar.xz
spack-278933e824d6ef0b791ec088070b86ed3c1f03b5.zip
init: remove template_dirs global
- remove template_dirs global variable from __init__.py - also remove update_template_dirs fixture, which had no effect on test correctness
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/__init__.py6
-rw-r--r--lib/spack/spack/tengine.py8
-rw-r--r--lib/spack/spack/test/modules/conftest.py8
-rw-r--r--lib/spack/spack/test/modules/dotkit.py2
-rw-r--r--lib/spack/spack/test/modules/lmod.py2
-rw-r--r--lib/spack/spack/test/modules/tcl.py3
6 files changed, 5 insertions, 24 deletions
diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py
index 4734b4b990..6cdfd4c72e 100644
--- a/lib/spack/spack/__init__.py
+++ b/lib/spack/spack/__init__.py
@@ -38,18 +38,12 @@ import multiprocessing
# TODO: Below code should not import modules other than spack.config
#-----------------------------------------------------------------------------
import spack.config
-from spack.util.path import canonicalize_path
# TODO: get this out of __init__.py
binary_cache_retrieved_specs = set()
-#: Directories where to search for templates
-template_dirs = spack.config.get('config:template_dirs')
-template_dirs = [canonicalize_path(x) for x in template_dirs]
-
-
# If this is True, spack will not clean the environment to remove
# potentially harmful variables before builds.
dirty = spack.config.get('config:dirty', False)
diff --git a/lib/spack/spack/tengine.py b/lib/spack/spack/tengine.py
index d49b4c69b2..731ce78782 100644
--- a/lib/spack/spack/tengine.py
+++ b/lib/spack/spack/tengine.py
@@ -22,13 +22,14 @@
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
-
import textwrap
import jinja2
import llnl.util.lang
import six
-import spack
+
+import spack.config
+from spack.util.path import canonicalize_path
TemplateNotFound = jinja2.TemplateNotFound
@@ -90,7 +91,8 @@ def make_environment(dirs=None):
"""Returns an configured environment for template rendering."""
if dirs is None:
# Default directories where to search for templates
- dirs = spack.template_dirs
+ dirs = [canonicalize_path(d)
+ for d in spack.config.get('config:template_dirs')]
# Loader for the templates
loader = jinja2.FileSystemLoader(dirs)
# Environment of the template engine
diff --git a/lib/spack/spack/test/modules/conftest.py b/lib/spack/spack/test/modules/conftest.py
index 6fb9a4d368..6cf6f7e1a5 100644
--- a/lib/spack/spack/test/modules/conftest.py
+++ b/lib/spack/spack/test/modules/conftest.py
@@ -91,14 +91,6 @@ def modulefile_content(filename_dict, request):
@pytest.fixture()
-def update_template_dirs(config, monkeypatch):
- """Mocks the template directories for tests"""
- dirs = spack.config.get('config:template_dirs')
- dirs = [spack.util.path.canonicalize_path(x) for x in dirs]
- monkeypatch.setattr(spack, 'template_dirs', dirs)
-
-
-@pytest.fixture()
def patch_configuration(monkeypatch, request):
"""Reads a configuration file from the mock ones prepared for tests
and monkeypatches the right classes to hook it in.
diff --git a/lib/spack/spack/test/modules/dotkit.py b/lib/spack/spack/test/modules/dotkit.py
index d471674f27..71c253b479 100644
--- a/lib/spack/spack/test/modules/dotkit.py
+++ b/lib/spack/spack/test/modules/dotkit.py
@@ -45,7 +45,6 @@ class TestDotkit(object):
assert '#d mpileaks @2.3' in content
assert len([x for x in content if 'dk_op' in x]) == 2
- @pytest.mark.usefixtures('update_template_dirs')
def test_override_template_in_package(
self, modulefile_content, patch_configuration
):
@@ -56,7 +55,6 @@ class TestDotkit(object):
assert 'Override successful!' in content
- @pytest.mark.usefixtures('update_template_dirs')
def test_override_template_in_modules_yaml(
self, modulefile_content, patch_configuration
):
diff --git a/lib/spack/spack/test/modules/lmod.py b/lib/spack/spack/test/modules/lmod.py
index 11ebf0302a..9405c68062 100644
--- a/lib/spack/spack/test/modules/lmod.py
+++ b/lib/spack/spack/test/modules/lmod.py
@@ -213,7 +213,6 @@ class TestLmod(object):
with pytest.raises(spack.modules.lmod.NonVirtualInHierarchyError):
module.write()
- @pytest.mark.usefixtures('update_template_dirs')
def test_override_template_in_package(
self, modulefile_content, patch_configuration
):
@@ -224,7 +223,6 @@ class TestLmod(object):
assert 'Override successful!' in content
- @pytest.mark.usefixtures('update_template_dirs')
def test_override_template_in_modules_yaml(
self, modulefile_content, patch_configuration
):
diff --git a/lib/spack/spack/test/modules/tcl.py b/lib/spack/spack/test/modules/tcl.py
index 753cd57ddc..8eb9c918dd 100644
--- a/lib/spack/spack/test/modules/tcl.py
+++ b/lib/spack/spack/test/modules/tcl.py
@@ -241,7 +241,6 @@ class TestTcl(object):
[x for x in content if 'setenv FOOBAR "callpath"' in x]
) == 1
- @pytest.mark.usefixtures('update_template_dirs')
def test_override_template_in_package(
self, modulefile_content, patch_configuration
):
@@ -252,7 +251,6 @@ class TestTcl(object):
assert 'Override successful!' in content
- @pytest.mark.usefixtures('update_template_dirs')
def test_override_template_in_modules_yaml(
self, modulefile_content, patch_configuration
):
@@ -265,7 +263,6 @@ class TestTcl(object):
content = modulefile_content('mpileaks arch=x86-linux')
assert 'Override even better!' in content
- @pytest.mark.usefixtures('update_template_dirs')
def test_extend_context(
self, modulefile_content, patch_configuration
):