diff options
Diffstat (limited to 'lib/spack/spack/test/modules/lmod.py')
-rw-r--r-- | lib/spack/spack/test/modules/lmod.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/spack/spack/test/modules/lmod.py b/lib/spack/spack/test/modules/lmod.py index a29d8ac2ac..e82c9b8b9d 100644 --- a/lib/spack/spack/test/modules/lmod.py +++ b/lib/spack/spack/test/modules/lmod.py @@ -2,7 +2,9 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import os import re +import sys import pytest @@ -42,6 +44,7 @@ def provider(request): @pytest.mark.usefixtures('config', 'mock_packages',) class TestLmod(object): + @pytest.mark.skipif(os.name == 'nt', reason="Skip test on Windows") def test_file_layout( self, compiler, provider, factory, module_configuration ): @@ -79,6 +82,7 @@ class TestLmod(object): else: assert repetitions == 1 + @pytest.mark.skipif(os.name == 'nt', reason="Skip test on Windows") def test_simple_case(self, modulefile_content, module_configuration): """Tests the generation of a simple TCL module file.""" @@ -90,6 +94,7 @@ class TestLmod(object): assert 'whatis([[Version : 3.0.4]])' in content assert 'family("mpi")' in content + @pytest.mark.skipif(os.name == 'nt', reason="Skip test on Windows") def test_autoload_direct(self, modulefile_content, module_configuration): """Tests the automatic loading of direct dependencies.""" @@ -98,6 +103,7 @@ class TestLmod(object): assert len([x for x in content if 'depends_on(' in x]) == 2 + @pytest.mark.skipif(os.name == 'nt', reason="Skip test on Windows") def test_autoload_all(self, modulefile_content, module_configuration): """Tests the automatic loading of all dependencies.""" @@ -106,6 +112,7 @@ class TestLmod(object): assert len([x for x in content if 'depends_on(' in x]) == 5 + @pytest.mark.skipif(os.name == 'nt', reason="Skip test on Windows") def test_alter_environment(self, modulefile_content, module_configuration): """Tests modifications to run-time environment.""" @@ -128,6 +135,7 @@ class TestLmod(object): assert len([x for x in content if 'setenv("FOO", "foo")' in x]) == 0 assert len([x for x in content if 'unsetenv("BAR")' in x]) == 0 + @pytest.mark.skipif(os.name == 'nt', reason="Skip test on Windows") def test_prepend_path_separator(self, modulefile_content, module_configuration): """Tests modifications to run-time environment.""" @@ -141,6 +149,7 @@ class TestLmod(object): elif re.match(r'[a-z]+_path\("SEMICOLON"', line): assert line.endswith('"bar", ";")') + @pytest.mark.skipif(os.name == 'nt', reason="Skip test on Windows") def test_blacklist(self, modulefile_content, module_configuration): """Tests blacklisting the generation of selected modules.""" @@ -149,6 +158,7 @@ class TestLmod(object): assert len([x for x in content if 'depends_on(' in x]) == 1 + @pytest.mark.skipif(os.name == 'nt', reason="Skip test on Windows") def test_no_hash(self, factory, module_configuration): """Makes sure that virtual providers (in the hierarchy) always include a hash. Make sure that the module file for the spec @@ -173,6 +183,7 @@ class TestLmod(object): assert path.endswith(mpileaks_element) + @pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed") def test_no_core_compilers(self, factory, module_configuration): """Ensures that missing 'core_compilers' in the configuration file raises the right exception. @@ -192,6 +203,7 @@ class TestLmod(object): with pytest.raises(spack.modules.lmod.CoreCompilersNotFoundError): module.write() + @pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed") def test_non_virtual_in_hierarchy(self, factory, module_configuration): """Ensures that if a non-virtual is in hierarchy, an exception will be raised. @@ -202,6 +214,7 @@ class TestLmod(object): with pytest.raises(spack.modules.lmod.NonVirtualInHierarchyError): module.write() + @pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed") def test_override_template_in_package( self, modulefile_content, module_configuration ): @@ -212,6 +225,7 @@ class TestLmod(object): assert 'Override successful!' in content + @pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed") def test_override_template_in_modules_yaml( self, modulefile_content, module_configuration ): @@ -224,6 +238,7 @@ class TestLmod(object): content = modulefile_content('mpileaks target=x86_64') assert 'Override even better!' in content + @pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed") @pytest.mark.usefixtures('config') def test_external_configure_args( self, factory @@ -234,6 +249,7 @@ class TestLmod(object): assert 'unknown' in writer.context.configure_options + @pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed") def test_guess_core_compilers( self, factory, module_configuration, monkeypatch ): @@ -257,6 +273,7 @@ class TestLmod(object): writer, _ = factory(mpileaks_spec_string) assert writer.conf.core_compilers + @pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed") @pytest.mark.parametrize('spec_str', [ 'mpileaks target=nocona', 'mpileaks target=core2', @@ -273,6 +290,7 @@ class TestLmod(object): if spec.target.family != spec.target: assert str(spec.target) not in writer.layout.arch_dirname + @pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed") def test_projections_specific(self, factory, module_configuration): """Tests reading the correct naming scheme.""" @@ -291,6 +309,7 @@ class TestLmod(object): projection = writer.spec.format(writer.conf.projections['mpileaks']) assert projection in writer.layout.use_name + @pytest.mark.skipif(os.name == 'nt', reason="Skip test on Windows") def test_projections_all(self, factory, module_configuration): """Tests reading the correct naming scheme.""" @@ -309,6 +328,7 @@ class TestLmod(object): projection = writer.spec.format(writer.conf.projections['all']) assert projection in writer.layout.use_name + @pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed") def test_config_backwards_compat(self, mutable_config): settings = { 'enable': ['lmod'], @@ -326,6 +346,7 @@ class TestLmod(object): assert old_format == new_format assert old_format == settings['lmod'] + @pytest.mark.skipif(os.name == 'nt', reason="Skip test on Windows") def test_modules_relative_to_view( self, tmpdir, modulefile_content, module_configuration, install_mockery, mock_fetch |