Update tests support for Windows

Fixup common tests

    * Remove requirement for Python 2.6
    * Skip new failing test

Windows: Update url util to handle Windows paths (#27959)

    * update url util to handle windows paths

    * Update tests to handle fixed url handling

    * canonicalize path only when the path type matches the host platform

    * Skip some url tests on Windows

Co-authored-by: Omar Padron <omar.padron@kitware.com>

Use threading.TIMEOUT_MAX when available (#24246)

This value was introduced in Python 3.2. Specifying a timeout greater than
this value will raise an OverflowError.

Co-authored-by: Lou Lawrence <lou.lawrence@kitware.com>
Co-authored-by: John Parent <john.parent@kitware.com>
Co-authored-by: Betsy McPhail <betsy.mcphail@kitware.com>
This commit is contained in:
Betsy McPhail 2021-10-21 16:59:33 -04:00 committed by Peter Scheibel
parent 31daf0f2b6
commit 06aef626cb
126 changed files with 1923 additions and 198 deletions

View file

@ -27,9 +27,9 @@ jobs:
python -m pip install --upgrade pip python -m pip install --upgrade pip
python -m pip install --upgrade vermin python -m pip install --upgrade vermin
- name: vermin (Spack's Core) - name: vermin (Spack's Core)
run: vermin --backport argparse --backport typing -t='2.6-' -t='3.5-' -v spack/lib/spack/spack/ spack/lib/spack/llnl/ spack/bin/ run: vermin --backport argparse --backport typing -t='2.7-' -t='3.5-' -v spack/lib/spack/spack/ spack/lib/spack/llnl/ spack/bin/
- name: vermin (Repositories) - name: vermin (Repositories)
run: vermin --backport argparse --backport typing -t='2.6-' -t='3.5-' -v spack/var/spack/repos run: vermin --backport argparse --backport typing -t='2.7-' -t='3.5-' -v spack/var/spack/repos
# Run style checks on the files that have been changed # Run style checks on the files that have been changed
style: style:
runs-on: windows-latest runs-on: windows-latest

View file

@ -16,7 +16,7 @@ popd
:: Check if Python is on the PATH :: Check if Python is on the PATH
if not defined python_pf_ver ( if not defined python_pf_ver (
(for /f "delims=" %%F in ('where python.exe') do ( (for /f "delims=" %%F in ('where python.exe') do (
set python_pf_ver=%%F set "python_pf_ver=%%F"
goto :found_python goto :found_python
) ) 2> NUL ) ) 2> NUL
) )
@ -25,19 +25,19 @@ if not defined python_pf_ver (
:: If not, look for Python from the Spack installer :: If not, look for Python from the Spack installer
:get_builtin :get_builtin
(for /f "tokens=*" %%g in ('dir /b /a:d "!spackinstdir!\Python*"') do ( (for /f "tokens=*" %%g in ('dir /b /a:d "!spackinstdir!\Python*"') do (
set python_ver=%%g)) 2> NUL set "python_ver=%%g")) 2> NUL
if not defined python_ver ( if not defined python_ver (
echo Python was not found on your system. echo Python was not found on your system.
echo Please install Python or add Python to your PATH. echo Please install Python or add Python to your PATH.
) else ( ) else (
set py_path=!spackinstdir!\!python_ver! set "py_path=!spackinstdir!\!python_ver!"
set py_exe=!py_path!\python.exe set "py_exe=!py_path!\python.exe"
) )
goto :exitpoint goto :exitpoint
) else ( ) else (
:: Python is already on the path :: Python is already on the path
set py_exe=!python_pf_ver! set "py_exe=!python_pf_ver!"
(for /F "tokens=* USEBACKQ" %%F in ( (for /F "tokens=* USEBACKQ" %%F in (
`"!py_exe!" --version`) do (set "output=%%F")) 2>NUL `"!py_exe!" --version`) do (set "output=%%F")) 2>NUL
if not "!output:Microsoft Store=!"=="!output!" goto :get_builtin if not "!output:Microsoft Store=!"=="!output!" goto :get_builtin

View file

@ -71,6 +71,8 @@
import re import re
import math import math
import multiprocessing import multiprocessing
import sys
import threading
import time import time
from contextlib import contextmanager from contextlib import contextmanager
@ -409,7 +411,12 @@ def parse(self, stream, context=6, jobs=None):
pool = multiprocessing.Pool(jobs) pool = multiprocessing.Pool(jobs)
try: try:
# this is a workaround for a Python bug in Pool with ctrl-C # this is a workaround for a Python bug in Pool with ctrl-C
results = pool.map_async(_parse_unpack, args, 1).get(9999999) if sys.version_info >= (3, 2):
max_timeout = threading.TIMEOUT_MAX
else:
max_timeout = 9999999
results = pool.map_async(_parse_unpack, args, 1).get(max_timeout)
errors, warnings, timings = zip(*results) errors, warnings, timings = zip(*results)
finally: finally:
pool.terminate() pool.terminate()

View file

@ -304,7 +304,9 @@ def candidate_urls(self):
urls = [] urls = []
for url in [self.url] + (self.mirrors or []): for url in [self.url] + (self.mirrors or []):
if url.startswith('file://'): if sys.platform == "win32":
url = url.replace("\\", "/")
if sys.platform != "win32" and url.startswith('file://'):
path = urllib_parse.quote(url[len('file://'):]) path = urllib_parse.quote(url[len('file://'):])
url = 'file://' + path url = 'file://' + path
urls.append(url) urls.append(url)
@ -1718,7 +1720,7 @@ def destroy(self):
class FetchError(spack.error.SpackError): class FetchError(spack.error.SpackError):
"""Superclass fo fetcher errors.""" """Superclass for fetcher errors."""
class NoCacheError(FetchError): class NoCacheError(FetchError):

View file

@ -25,6 +25,8 @@ def current_host_platform():
current_platform = spack.platforms.Linux() current_platform = spack.platforms.Linux()
elif 'Darwin' in platform.system(): elif 'Darwin' in platform.system():
current_platform = spack.platforms.Darwin() current_platform = spack.platforms.Darwin()
elif 'Windows' in platform.system():
current_platform = spack.platforms.Windows()
return current_platform return current_platform
@ -56,6 +58,8 @@ def test_platform(current_host_platform):
assert str(detected_platform) == str(current_host_platform) assert str(detected_platform) == str(current_host_platform)
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Test unsupported on Windows")
def test_user_input_combination(config, target_str, os_str): def test_user_input_combination(config, target_str, os_str):
"""Test for all the valid user input combinations that both the target and """Test for all the valid user input combinations that both the target and
the operating system match. the operating system match.

View file

@ -338,6 +338,8 @@ def test_relative_rpaths_install_nondefault(mirror_dir):
buildcache_cmd('install', '-auf', cspec.name) buildcache_cmd('install', '-auf', cspec.name)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_push_and_fetch_keys(mock_gnupghome): def test_push_and_fetch_keys(mock_gnupghome):
testpath = str(mock_gnupghome) testpath = str(mock_gnupghome)
@ -426,6 +428,8 @@ def fake_full_hash(spec):
'install_mockery_mutable_config', 'mock_packages', 'mock_fetch', 'install_mockery_mutable_config', 'mock_packages', 'mock_fetch',
'test_mirror' 'test_mirror'
) )
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_spec_needs_rebuild(monkeypatch, tmpdir): def test_spec_needs_rebuild(monkeypatch, tmpdir):
"""Make sure needs_rebuild properly compares remote full_hash """Make sure needs_rebuild properly compares remote full_hash
against locally computed one, avoiding unnecessary rebuilds""" against locally computed one, avoiding unnecessary rebuilds"""
@ -454,6 +458,8 @@ def test_spec_needs_rebuild(monkeypatch, tmpdir):
assert rebuild assert rebuild
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.usefixtures( @pytest.mark.usefixtures(
'install_mockery_mutable_config', 'mock_packages', 'mock_fetch', 'install_mockery_mutable_config', 'mock_packages', 'mock_fetch',
) )
@ -493,6 +499,8 @@ def test_generate_index_missing(monkeypatch, tmpdir, mutable_config):
assert 'libelf' not in cache_list assert 'libelf' not in cache_list
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_generate_indices_key_error(monkeypatch, capfd): def test_generate_indices_key_error(monkeypatch, capfd):
def mock_list_url(url, recursive=False): def mock_list_url(url, recursive=False):
@ -541,6 +549,8 @@ def mock_list_url(url, recursive=False):
assert expect in err assert expect in err
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.usefixtures('mock_fetch', 'install_mockery') @pytest.mark.usefixtures('mock_fetch', 'install_mockery')
def test_update_sbang(tmpdir, test_mirror): def test_update_sbang(tmpdir, test_mirror):
"""Test the creation and installation of buildcaches with default rpaths """Test the creation and installation of buildcaches with default rpaths
@ -612,6 +622,8 @@ def test_update_sbang(tmpdir, test_mirror):
uninstall_cmd('-y', '/%s' % new_spec.dag_hash()) uninstall_cmd('-y', '/%s' % new_spec.dag_hash())
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
# Need one where the platform has been changed to the test platform. # Need one where the platform has been changed to the test platform.
def test_install_legacy_yaml(test_legacy_mirror, install_mockery_mutable_config, def test_install_legacy_yaml(test_legacy_mirror, install_mockery_mutable_config,
mock_packages): mock_packages):
@ -621,6 +633,8 @@ def test_install_legacy_yaml(test_legacy_mirror, install_mockery_mutable_config,
uninstall_cmd('-y', '/t5mczux3tfqpxwmg7egp7axy2jvyulqk') uninstall_cmd('-y', '/t5mczux3tfqpxwmg7egp7axy2jvyulqk')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.usefixtures( @pytest.mark.usefixtures(
'install_mockery_mutable_config', 'mock_packages', 'mock_fetch', 'install_mockery_mutable_config', 'mock_packages', 'mock_fetch',
) )

View file

@ -2,6 +2,8 @@
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import pytest import pytest
import spack.bootstrap import spack.bootstrap
@ -125,6 +127,10 @@ def test_custom_store_in_environment(mutable_config, tmpdir):
install_tree: install_tree:
root: /tmp/store root: /tmp/store
""") """)
if os.name == 'nt':
sep = '\\'
else:
sep = '/'
with spack.environment.Environment(str(tmpdir)): with spack.environment.Environment(str(tmpdir)):
assert spack.environment.active_environment() assert spack.environment.active_environment()
assert spack.config.get('config:install_tree:root') == '/tmp/store' assert spack.config.get('config:install_tree:root') == '/tmp/store'

View file

@ -5,6 +5,7 @@
import os import os
import os.path import os.path
import sys
import pytest import pytest
@ -14,6 +15,8 @@
install = spack.main.SpackCommand('install') install = spack.main.SpackCommand('install')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_build_tarball_overwrite( def test_build_tarball_overwrite(
install_mockery, mock_fetch, monkeypatch, tmpdir): install_mockery, mock_fetch, monkeypatch, tmpdir):

View file

@ -5,6 +5,8 @@
import os import os
import platform import platform
import posixpath
import sys
import pytest import pytest
@ -81,6 +83,8 @@ def _ensure(env_mods):
return _ensure return _ensure
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_static_to_shared_library(build_environment): def test_static_to_shared_library(build_environment):
os.environ['SPACK_TEST_COMMAND'] = 'dump-args' os.environ['SPACK_TEST_COMMAND'] = 'dump-args'
@ -135,6 +139,8 @@ def _set_wrong_cc(x):
assert os.environ['ANOTHER_VAR'] == 'THIS_IS_SET' assert os.environ['ANOTHER_VAR'] == 'THIS_IS_SET'
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize('initial,modifications,expected', [ @pytest.mark.parametrize('initial,modifications,expected', [
# Set and unset variables # Set and unset variables
({'SOME_VAR_STR': '', 'SOME_VAR_NUM': '0'}, ({'SOME_VAR_STR': '', 'SOME_VAR_NUM': '0'},
@ -184,7 +190,10 @@ def test_compiler_config_modifications(
# Check they were applied # Check they were applied
for name, value in expected.items(): for name, value in expected.items():
if value is not None: if value is not None:
assert os.environ[name] == value eviron_value = os.environ[name]
if sys.platform == "win32":
eviron_value = eviron_value.replace("\\", "/")
assert eviron_value == value
continue continue
assert name not in os.environ assert name not in os.environ
@ -199,7 +208,7 @@ def test_spack_paths_before_module_paths(
module_path = '/path/to/module' module_path = '/path/to/module'
def _set_wrong_cc(x): def _set_wrong_cc(x):
os.environ['PATH'] = module_path + ':' + os.environ['PATH'] os.environ['PATH'] = module_path + os.pathsep + os.environ['PATH']
monkeypatch.setattr( monkeypatch.setattr(
spack.build_environment, 'load_module', _set_wrong_cc spack.build_environment, 'load_module', _set_wrong_cc
@ -210,8 +219,11 @@ def _set_wrong_cc(x):
spack.build_environment.setup_package(pkg, False) spack.build_environment.setup_package(pkg, False)
spack_path = os.path.join(spack.paths.prefix, 'lib/spack/env') spack_path = posixpath.join(spack.paths.prefix, 'lib/spack/env')
paths = os.environ['PATH'].split(':')
paths = os.environ['PATH'].split(os.pathsep)
if sys.platform == 'win32':
paths = [p.replace("\\", "/") for p in paths]
assert paths.index(spack_path) < paths.index(module_path) assert paths.index(spack_path) < paths.index(module_path)
@ -244,10 +256,10 @@ def test_wrapper_variables(
'prefix/include/cuda/atomic', 'prefix/include/cuda/atomic',
'prefix/include/cuda/std/detail/libcxx/include/ctype.h']) 'prefix/include/cuda/std/detail/libcxx/include/ctype.h'])
cuda_include_dirs = cuda_headers.directories cuda_include_dirs = cuda_headers.directories
assert(os.path.join('prefix', 'include') assert(posixpath.join('prefix', 'include')
in cuda_include_dirs) in cuda_include_dirs)
assert(os.path.join('prefix', 'include', 'cuda', 'std', 'detail', assert(posixpath.join('prefix', 'include', 'cuda', 'std', 'detail',
'libcxx', 'include') 'libcxx', 'include')
not in cuda_include_dirs) not in cuda_include_dirs)
root = spack.spec.Spec('dt-diamond') root = spack.spec.Spec('dt-diamond')
@ -293,7 +305,7 @@ def normpaths(paths):
# The default implementation looks for header files only # The default implementation looks for header files only
# in <prefix>/include and subdirectories # in <prefix>/include and subdirectories
prefix = str(installation_dir_with_headers) prefix = str(installation_dir_with_headers)
include_dirs = normpaths(header_dir_var.split(':')) include_dirs = normpaths(header_dir_var.split(os.pathsep))
assert os.path.join(prefix, 'include') in include_dirs assert os.path.join(prefix, 'include') in include_dirs
assert os.path.join(prefix, 'include', 'boost') not in include_dirs assert os.path.join(prefix, 'include', 'boost') not in include_dirs
@ -334,7 +346,8 @@ def _trust_me_its_a_dir(path):
env_mods.apply_modifications() env_mods.apply_modifications()
link_dir_var = os.environ['SPACK_LINK_DIRS'] link_dir_var = os.environ['SPACK_LINK_DIRS']
link_dirs = link_dir_var.split(':') link_dirs = link_dir_var.split(':')
external_lib_paths = set(['/fake/path1/lib', '/fake/path1/lib64']) external_lib_paths = set([os.path.normpath('/fake/path1/lib'),
os.path.normpath('/fake/path1/lib64')])
# The external lib paths should be the last two entries of the list and # The external lib paths should be the last two entries of the list and
# should not appear anywhere before the last two entries # should not appear anywhere before the last two entries
assert (set(os.path.normpath(x) for x in link_dirs[-2:]) == assert (set(os.path.normpath(x) for x in link_dirs[-2:]) ==

View file

@ -3,6 +3,7 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest import pytest
@ -51,6 +52,8 @@ def url_and_build_system(request, tmpdir):
orig_dir.chdir() orig_dir.chdir()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_build_systems(url_and_build_system): def test_build_systems(url_and_build_system):
url, build_system = url_and_build_system url, build_system = url_and_build_system
with spack.stage.Stage(url) as stage: with spack.stage.Stage(url) as stage:

View file

@ -5,12 +5,15 @@
import glob import glob
import os import os
import sys
import pytest import pytest
import llnl.util.filesystem as fs import llnl.util.filesystem as fs
import spack.environment import spack.environment
import spack.error as serr
import spack.platforms
import spack.repo import spack.repo
from spack.build_environment import ChildError, get_std_cmake_args, setup_package from spack.build_environment import ChildError, get_std_cmake_args, setup_package
from spack.spec import Spec from spack.spec import Spec
@ -19,6 +22,8 @@
DATA_PATH = os.path.join(spack.paths.test_path, 'data') DATA_PATH = os.path.join(spack.paths.test_path, 'data')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize( @pytest.mark.parametrize(
'directory', 'directory',
glob.iglob(os.path.join(DATA_PATH, 'make', 'affirmative', '*')) glob.iglob(os.path.join(DATA_PATH, 'make', 'affirmative', '*'))
@ -38,6 +43,8 @@ def test_affirmative_make_check(directory, config, mock_packages, working_env):
pkg._if_make_target_execute('check') pkg._if_make_target_execute('check')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize( @pytest.mark.parametrize(
'directory', 'directory',
glob.iglob(os.path.join(DATA_PATH, 'make', 'negative', '*')) glob.iglob(os.path.join(DATA_PATH, 'make', 'negative', '*'))
@ -104,6 +111,8 @@ def test_negative_ninja_check(directory, config, mock_packages, working_env):
pkg._if_ninja_target_execute('check') pkg._if_ninja_target_execute('check')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_cmake_std_args(config, mock_packages): def test_cmake_std_args(config, mock_packages):
# Call the function on a CMakePackage instance # Call the function on a CMakePackage instance
s = Spec('cmake-client') s = Spec('cmake-client')
@ -118,15 +127,16 @@ def test_cmake_std_args(config, mock_packages):
assert get_std_cmake_args(pkg) assert get_std_cmake_args(pkg)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_cmake_bad_generator(config, mock_packages): def test_cmake_bad_generator(config, mock_packages):
s = Spec('cmake-client') with pytest.raises(serr.SpackError):
s.concretize() s = Spec('cmake-client generator="Yellow Sticky Note"')
pkg = spack.repo.get(s) s.concretize()
pkg.generator = 'Yellow Sticky Notes'
with pytest.raises(spack.package.InstallError):
get_std_cmake_args(pkg)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_cmake_secondary_generator(config, mock_packages): def test_cmake_secondary_generator(config, mock_packages):
s = Spec('cmake-client') s = Spec('cmake-client')
s.concretize() s.concretize()
@ -138,6 +148,8 @@ def test_cmake_secondary_generator(config, mock_packages):
@pytest.mark.usefixtures('config', 'mock_packages') @pytest.mark.usefixtures('config', 'mock_packages')
class TestAutotoolsPackage(object): class TestAutotoolsPackage(object):
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_with_or_without(self): def test_with_or_without(self):
s = Spec('a') s = Spec('a')
s.concretize() s.concretize()
@ -173,6 +185,8 @@ def activate(value):
options = pkg.with_or_without('lorem-ipsum', variant='lorem_ipsum') options = pkg.with_or_without('lorem-ipsum', variant='lorem_ipsum')
assert '--without-lorem-ipsum' in options assert '--without-lorem-ipsum' in options
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_none_is_allowed(self): def test_none_is_allowed(self):
s = Spec('a foo=none') s = Spec('a foo=none')
s.concretize() s.concretize()
@ -187,6 +201,8 @@ def test_none_is_allowed(self):
assert '--without-baz' in options assert '--without-baz' in options
assert '--no-fee' in options assert '--no-fee' in options
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_libtool_archive_files_are_deleted_by_default( def test_libtool_archive_files_are_deleted_by_default(
self, mutable_database self, mutable_database
): ):
@ -204,6 +220,8 @@ def test_libtool_archive_files_are_deleted_by_default(
) )
assert libtool_deletion_log assert libtool_deletion_log
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_libtool_archive_files_might_be_installed_on_demand( def test_libtool_archive_files_might_be_installed_on_demand(
self, mutable_database, monkeypatch self, mutable_database, monkeypatch
): ):
@ -217,6 +235,8 @@ def test_libtool_archive_files_might_be_installed_on_demand(
# Assert libtool archives are installed # Assert libtool archives are installed
assert os.path.exists(s.package.libtool_archive_file) assert os.path.exists(s.package.libtool_archive_file)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_autotools_gnuconfig_replacement(self, mutable_database): def test_autotools_gnuconfig_replacement(self, mutable_database):
""" """
Tests whether only broken config.sub and config.guess are replaced with Tests whether only broken config.sub and config.guess are replaced with
@ -238,6 +258,8 @@ def test_autotools_gnuconfig_replacement(self, mutable_database):
with open(os.path.join(s.prefix.working, 'config.guess')) as f: with open(os.path.join(s.prefix.working, 'config.guess')) as f:
assert "gnuconfig version of config.guess" not in f.read() assert "gnuconfig version of config.guess" not in f.read()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_autotools_gnuconfig_replacement_disabled(self, mutable_database): def test_autotools_gnuconfig_replacement_disabled(self, mutable_database):
""" """
Tests whether disabling patch_config_files Tests whether disabling patch_config_files
@ -258,6 +280,8 @@ def test_autotools_gnuconfig_replacement_disabled(self, mutable_database):
with open(os.path.join(s.prefix.working, 'config.guess')) as f: with open(os.path.join(s.prefix.working, 'config.guess')) as f:
assert "gnuconfig version of config.guess" not in f.read() assert "gnuconfig version of config.guess" not in f.read()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_autotools_gnuconfig_replacement_no_gnuconfig(self, mutable_database): def test_autotools_gnuconfig_replacement_no_gnuconfig(self, mutable_database):
""" """
@ -271,6 +295,8 @@ def test_autotools_gnuconfig_replacement_no_gnuconfig(self, mutable_database):
with pytest.raises(ChildError, match=msg): with pytest.raises(ChildError, match=msg):
s.package.do_install() s.package.do_install()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_broken_external_gnuconfig(self, mutable_database, tmpdir): def test_broken_external_gnuconfig(self, mutable_database, tmpdir):
""" """
@ -301,6 +327,8 @@ def test_broken_external_gnuconfig(self, mutable_database, tmpdir):
e.install_all() e.install_all()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.usefixtures('config', 'mock_packages') @pytest.mark.usefixtures('config', 'mock_packages')
class TestCMakePackage(object): class TestCMakePackage(object):
@ -342,6 +370,8 @@ def test_define_from_variant(self):
pkg.define_from_variant('NONEXISTENT') pkg.define_from_variant('NONEXISTENT')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.usefixtures('config', 'mock_packages') @pytest.mark.usefixtures('config', 'mock_packages')
class TestGNUMirrorPackage(object): class TestGNUMirrorPackage(object):
@ -365,6 +395,8 @@ def test_define(self):
'make/make-4.2.1.tar.gz' 'make/make-4.2.1.tar.gz'
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.usefixtures('config', 'mock_packages') @pytest.mark.usefixtures('config', 'mock_packages')
class TestSourceforgePackage(object): class TestSourceforgePackage(object):
@ -388,6 +420,8 @@ def test_define(self):
'tcl/tcl8.6.5-src.tar.gz' 'tcl/tcl8.6.5-src.tar.gz'
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.usefixtures('config', 'mock_packages') @pytest.mark.usefixtures('config', 'mock_packages')
class TestSourcewarePackage(object): class TestSourcewarePackage(object):
@ -411,6 +445,8 @@ def test_define(self):
'bzip2/bzip2-1.0.8.tar.gz' 'bzip2/bzip2-1.0.8.tar.gz'
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.usefixtures('config', 'mock_packages') @pytest.mark.usefixtures('config', 'mock_packages')
class TestXorgPackage(object): class TestXorgPackage(object):

View file

@ -3,6 +3,8 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest import pytest
import spack.installer as inst import spack.installer as inst
@ -19,6 +21,8 @@ def test_build_request_errors(install_mockery):
inst.BuildRequest(pkg, {}) inst.BuildRequest(pkg, {})
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_build_request_basics(install_mockery): def test_build_request_basics(install_mockery):
spec = spack.spec.Spec('dependent-install') spec = spack.spec.Spec('dependent-install')
spec.concretize() spec.concretize()
@ -35,6 +39,8 @@ def test_build_request_basics(install_mockery):
assert 'install_deps' in request.install_args assert 'install_deps' in request.install_args
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_build_request_strings(install_mockery): def test_build_request_strings(install_mockery):
"""Tests of BuildRequest repr and str for coverage purposes.""" """Tests of BuildRequest repr and str for coverage purposes."""
# Using a package with one dependency # Using a package with one dependency

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os import os
import sys
import pytest import pytest
@ -25,6 +26,8 @@ def test_fetch_missing_cache(tmpdir, _fetch_method):
fetcher.fetch() fetcher.fetch()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize('_fetch_method', ['curl', 'urllib']) @pytest.mark.parametrize('_fetch_method', ['curl', 'urllib'])
def test_fetch(tmpdir, _fetch_method): def test_fetch(tmpdir, _fetch_method):
"""Ensure a fetch after expanding is effectively a no-op.""" """Ensure a fetch after expanding is effectively a no-op."""

View file

@ -8,6 +8,7 @@
arguments correctly. arguments correctly.
""" """
import os import os
import sys
import pytest import pytest
@ -170,12 +171,14 @@ def dump_mode(cc, args):
return cc(*args, output=str).strip() return cc(*args, output=str).strip()
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_no_wrapper_environment(): def test_no_wrapper_environment():
with pytest.raises(ProcessError): with pytest.raises(ProcessError):
output = cc(output=str) output = cc(output=str)
assert "Spack compiler must be run from Spack" in output assert "Spack compiler must be run from Spack" in output
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_vcheck_mode(wrapper_environment): def test_vcheck_mode(wrapper_environment):
assert dump_mode(cc, ['-I/include', '--version']) == 'vcheck' assert dump_mode(cc, ['-I/include', '--version']) == 'vcheck'
assert dump_mode(cc, ['-I/include', '-V']) == 'vcheck' assert dump_mode(cc, ['-I/include', '-V']) == 'vcheck'
@ -185,16 +188,19 @@ def test_vcheck_mode(wrapper_environment):
assert dump_mode(cc, ['-I/include', '-V', '-o', 'output']) == 'vcheck' assert dump_mode(cc, ['-I/include', '-V', '-o', 'output']) == 'vcheck'
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_cpp_mode(wrapper_environment): def test_cpp_mode(wrapper_environment):
assert dump_mode(cc, ['-E']) == 'cpp' assert dump_mode(cc, ['-E']) == 'cpp'
assert dump_mode(cxx, ['-E']) == 'cpp' assert dump_mode(cxx, ['-E']) == 'cpp'
assert dump_mode(cpp, []) == 'cpp' assert dump_mode(cpp, []) == 'cpp'
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_as_mode(wrapper_environment): def test_as_mode(wrapper_environment):
assert dump_mode(cc, ['-S']) == 'as' assert dump_mode(cc, ['-S']) == 'as'
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_ccld_mode(wrapper_environment): def test_ccld_mode(wrapper_environment):
assert dump_mode(cc, []) == 'ccld' assert dump_mode(cc, []) == 'ccld'
assert dump_mode(cc, ['foo.c', '-o', 'foo']) == 'ccld' assert dump_mode(cc, ['foo.c', '-o', 'foo']) == 'ccld'
@ -203,12 +209,14 @@ def test_ccld_mode(wrapper_environment):
'foo.o', 'bar.o', 'baz.o', '-o', 'foo', '-Wl,-rpath,foo']) == 'ccld' 'foo.o', 'bar.o', 'baz.o', '-o', 'foo', '-Wl,-rpath,foo']) == 'ccld'
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_ld_mode(wrapper_environment): def test_ld_mode(wrapper_environment):
assert dump_mode(ld, []) == 'ld' assert dump_mode(ld, []) == 'ld'
assert dump_mode(ld, [ assert dump_mode(ld, [
'foo.o', 'bar.o', 'baz.o', '-o', 'foo', '-Wl,-rpath,foo']) == 'ld' 'foo.o', 'bar.o', 'baz.o', '-o', 'foo', '-Wl,-rpath,foo']) == 'ld'
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_ld_flags(wrapper_environment, wrapper_flags): def test_ld_flags(wrapper_environment, wrapper_flags):
check_args( check_args(
ld, test_args, ld, test_args,
@ -222,6 +230,7 @@ def test_ld_flags(wrapper_environment, wrapper_flags):
spack_ldlibs) spack_ldlibs)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_cpp_flags(wrapper_environment, wrapper_flags): def test_cpp_flags(wrapper_environment, wrapper_flags):
check_args( check_args(
cpp, test_args, cpp, test_args,
@ -232,6 +241,7 @@ def test_cpp_flags(wrapper_environment, wrapper_flags):
test_args_without_paths) test_args_without_paths)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_cc_flags(wrapper_environment, wrapper_flags): def test_cc_flags(wrapper_environment, wrapper_flags):
check_args( check_args(
cc, test_args, cc, test_args,
@ -244,6 +254,7 @@ def test_cc_flags(wrapper_environment, wrapper_flags):
spack_ldlibs) spack_ldlibs)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_cxx_flags(wrapper_environment, wrapper_flags): def test_cxx_flags(wrapper_environment, wrapper_flags):
check_args( check_args(
cxx, test_args, cxx, test_args,
@ -256,6 +267,7 @@ def test_cxx_flags(wrapper_environment, wrapper_flags):
spack_ldlibs) spack_ldlibs)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_fc_flags(wrapper_environment, wrapper_flags): def test_fc_flags(wrapper_environment, wrapper_flags):
check_args( check_args(
fc, test_args, fc, test_args,
@ -268,6 +280,7 @@ def test_fc_flags(wrapper_environment, wrapper_flags):
spack_ldlibs) spack_ldlibs)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_dep_rpath(wrapper_environment): def test_dep_rpath(wrapper_environment):
"""Ensure RPATHs for root package are added.""" """Ensure RPATHs for root package are added."""
check_args( check_args(
@ -277,6 +290,7 @@ def test_dep_rpath(wrapper_environment):
common_compile_args) common_compile_args)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_dep_include(wrapper_environment): def test_dep_include(wrapper_environment):
"""Ensure a single dependency include directory is added.""" """Ensure a single dependency include directory is added."""
with set_env(SPACK_INCLUDE_DIRS='x'): with set_env(SPACK_INCLUDE_DIRS='x'):
@ -292,6 +306,7 @@ def test_dep_include(wrapper_environment):
test_args_without_paths) test_args_without_paths)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_system_path_cleanup(wrapper_environment): def test_system_path_cleanup(wrapper_environment):
"""Ensure SPACK_ENV_PATH is removed from PATH, even with trailing / """Ensure SPACK_ENV_PATH is removed from PATH, even with trailing /
@ -312,6 +327,7 @@ def test_system_path_cleanup(wrapper_environment):
check_env_var(cc, 'PATH', system_path) check_env_var(cc, 'PATH', system_path)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_dep_lib(wrapper_environment): def test_dep_lib(wrapper_environment):
"""Ensure a single dependency RPATH is added.""" """Ensure a single dependency RPATH is added."""
with set_env(SPACK_LINK_DIRS='x', with set_env(SPACK_LINK_DIRS='x',
@ -329,6 +345,7 @@ def test_dep_lib(wrapper_environment):
test_args_without_paths) test_args_without_paths)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_dep_lib_no_rpath(wrapper_environment): def test_dep_lib_no_rpath(wrapper_environment):
"""Ensure a single dependency link flag is added with no dep RPATH.""" """Ensure a single dependency link flag is added with no dep RPATH."""
with set_env(SPACK_LINK_DIRS='x'): with set_env(SPACK_LINK_DIRS='x'):
@ -344,6 +361,7 @@ def test_dep_lib_no_rpath(wrapper_environment):
test_args_without_paths) test_args_without_paths)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_dep_lib_no_lib(wrapper_environment): def test_dep_lib_no_lib(wrapper_environment):
"""Ensure a single dependency RPATH is added with no -L.""" """Ensure a single dependency RPATH is added with no -L."""
with set_env(SPACK_RPATH_DIRS='x'): with set_env(SPACK_RPATH_DIRS='x'):
@ -359,6 +377,7 @@ def test_dep_lib_no_lib(wrapper_environment):
test_args_without_paths) test_args_without_paths)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_ccld_deps(wrapper_environment): def test_ccld_deps(wrapper_environment):
"""Ensure all flags are added in ccld mode.""" """Ensure all flags are added in ccld mode."""
with set_env(SPACK_INCLUDE_DIRS='xinc:yinc:zinc', with set_env(SPACK_INCLUDE_DIRS='xinc:yinc:zinc',
@ -384,6 +403,7 @@ def test_ccld_deps(wrapper_environment):
test_args_without_paths) test_args_without_paths)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_ccld_deps_isystem(wrapper_environment): def test_ccld_deps_isystem(wrapper_environment):
"""Ensure all flags are added in ccld mode. """Ensure all flags are added in ccld mode.
When a build uses -isystem, Spack should inject it's When a build uses -isystem, Spack should inject it's
@ -415,6 +435,7 @@ def test_ccld_deps_isystem(wrapper_environment):
test_args_without_paths) test_args_without_paths)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_cc_deps(wrapper_environment): def test_cc_deps(wrapper_environment):
"""Ensure -L and RPATHs are not added in cc mode.""" """Ensure -L and RPATHs are not added in cc mode."""
with set_env(SPACK_INCLUDE_DIRS='xinc:yinc:zinc', with set_env(SPACK_INCLUDE_DIRS='xinc:yinc:zinc',
@ -433,6 +454,7 @@ def test_cc_deps(wrapper_environment):
test_args_without_paths) test_args_without_paths)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_ccld_with_system_dirs(wrapper_environment): def test_ccld_with_system_dirs(wrapper_environment):
"""Ensure all flags are added in ccld mode.""" """Ensure all flags are added in ccld mode."""
with set_env(SPACK_INCLUDE_DIRS='xinc:yinc:zinc', with set_env(SPACK_INCLUDE_DIRS='xinc:yinc:zinc',
@ -469,6 +491,7 @@ def test_ccld_with_system_dirs(wrapper_environment):
test_args_without_paths) test_args_without_paths)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_ccld_with_system_dirs_isystem(wrapper_environment): def test_ccld_with_system_dirs_isystem(wrapper_environment):
"""Ensure all flags are added in ccld mode. """Ensure all flags are added in ccld mode.
Ensure that includes are in the proper Ensure that includes are in the proper
@ -508,6 +531,7 @@ def test_ccld_with_system_dirs_isystem(wrapper_environment):
test_args_without_paths) test_args_without_paths)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_ld_deps(wrapper_environment): def test_ld_deps(wrapper_environment):
"""Ensure no (extra) -I args or -Wl, are passed in ld mode.""" """Ensure no (extra) -I args or -Wl, are passed in ld mode."""
with set_env(SPACK_INCLUDE_DIRS='xinc:yinc:zinc', with set_env(SPACK_INCLUDE_DIRS='xinc:yinc:zinc',
@ -529,6 +553,7 @@ def test_ld_deps(wrapper_environment):
test_args_without_paths) test_args_without_paths)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_ld_deps_no_rpath(wrapper_environment): def test_ld_deps_no_rpath(wrapper_environment):
"""Ensure SPACK_LINK_DEPS controls -L for ld.""" """Ensure SPACK_LINK_DEPS controls -L for ld."""
with set_env(SPACK_INCLUDE_DIRS='xinc:yinc:zinc', with set_env(SPACK_INCLUDE_DIRS='xinc:yinc:zinc',
@ -546,6 +571,7 @@ def test_ld_deps_no_rpath(wrapper_environment):
test_args_without_paths) test_args_without_paths)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_ld_deps_no_link(wrapper_environment): def test_ld_deps_no_link(wrapper_environment):
"""Ensure SPACK_RPATH_DEPS controls -rpath for ld.""" """Ensure SPACK_RPATH_DEPS controls -rpath for ld."""
with set_env(SPACK_INCLUDE_DIRS='xinc:yinc:zinc', with set_env(SPACK_INCLUDE_DIRS='xinc:yinc:zinc',
@ -563,6 +589,7 @@ def test_ld_deps_no_link(wrapper_environment):
test_args_without_paths) test_args_without_paths)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_ld_deps_partial(wrapper_environment): def test_ld_deps_partial(wrapper_environment):
"""Make sure ld -r (partial link) is handled correctly on OS's where it """Make sure ld -r (partial link) is handled correctly on OS's where it
doesn't accept rpaths. doesn't accept rpaths.
@ -601,6 +628,7 @@ def test_ld_deps_partial(wrapper_environment):
test_args_without_paths) test_args_without_paths)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_ccache_prepend_for_cc(wrapper_environment): def test_ccache_prepend_for_cc(wrapper_environment):
with set_env(SPACK_CCACHE_BINARY='ccache'): with set_env(SPACK_CCACHE_BINARY='ccache'):
os.environ['SPACK_SHORT_SPEC'] = "foo@1.2=linux-x86_64" os.environ['SPACK_SHORT_SPEC'] = "foo@1.2=linux-x86_64"
@ -620,6 +648,7 @@ def test_ccache_prepend_for_cc(wrapper_environment):
common_compile_args) common_compile_args)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_no_ccache_prepend_for_fc(wrapper_environment): def test_no_ccache_prepend_for_fc(wrapper_environment):
os.environ['SPACK_SHORT_SPEC'] = "foo@1.2=linux-x86_64" os.environ['SPACK_SHORT_SPEC'] = "foo@1.2=linux-x86_64"
check_args( check_args(
@ -638,6 +667,8 @@ def test_no_ccache_prepend_for_fc(wrapper_environment):
common_compile_args) common_compile_args)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.regression('9160') @pytest.mark.regression('9160')
def test_disable_new_dtags(wrapper_environment, wrapper_flags): def test_disable_new_dtags(wrapper_environment, wrapper_flags):
with set_env(SPACK_TEST_COMMAND='dump-args'): with set_env(SPACK_TEST_COMMAND='dump-args'):
@ -647,6 +678,8 @@ def test_disable_new_dtags(wrapper_environment, wrapper_flags):
assert '-Wl,--disable-new-dtags' in result assert '-Wl,--disable-new-dtags' in result
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.regression('9160') @pytest.mark.regression('9160')
def test_filter_enable_new_dtags(wrapper_environment, wrapper_flags): def test_filter_enable_new_dtags(wrapper_environment, wrapper_flags):
with set_env(SPACK_TEST_COMMAND='dump-args'): with set_env(SPACK_TEST_COMMAND='dump-args'):
@ -659,6 +692,8 @@ def test_filter_enable_new_dtags(wrapper_environment, wrapper_flags):
assert '-Wl,--enable-new-dtags' not in result assert '-Wl,--enable-new-dtags' not in result
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.regression('22643') @pytest.mark.regression('22643')
def test_linker_strips_loopopt(wrapper_environment, wrapper_flags): def test_linker_strips_loopopt(wrapper_environment, wrapper_flags):
with set_env(SPACK_TEST_COMMAND='dump-args'): with set_env(SPACK_TEST_COMMAND='dump-args'):

View file

@ -6,6 +6,7 @@
import itertools as it import itertools as it
import json import json
import os import os
import sys
import pytest import pytest
@ -50,6 +51,8 @@ def test_urlencode_string():
assert(s_enc == 'Spack+Test+Project') assert(s_enc == 'Spack+Test+Project')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_import_signing_key(mock_gnupghome): def test_import_signing_key(mock_gnupghome):
signing_key_dir = spack_paths.mock_gpg_keys_path signing_key_dir = spack_paths.mock_gpg_keys_path
signing_key_path = os.path.join(signing_key_dir, 'package-signing-key') signing_key_path = os.path.join(signing_key_dir, 'package-signing-key')
@ -83,6 +86,8 @@ def assert_present(config):
assert_present(last_config) assert_present(last_config)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_get_concrete_specs(config, mutable_mock_env_path, mock_packages): def test_get_concrete_specs(config, mutable_mock_env_path, mock_packages):
e = ev.create('test1') e = ev.create('test1')
e.add('dyninst') e.add('dyninst')
@ -172,6 +177,8 @@ def test_register_cdash_build(monkeypatch):
assert(build_id == 42) assert(build_id == 42)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_relate_cdash_builds(config, mutable_mock_env_path, mock_packages, def test_relate_cdash_builds(config, mutable_mock_env_path, mock_packages,
monkeypatch, capfd): monkeypatch, capfd):
e = ev.create('test1') e = ev.create('test1')
@ -236,6 +243,8 @@ def test_relate_cdash_builds(config, mutable_mock_env_path, mock_packages,
[cdashids_mirror_url]) [cdashids_mirror_url])
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_read_write_cdash_ids(config, tmp_scope, tmpdir, mock_packages): def test_read_write_cdash_ids(config, tmp_scope, tmpdir, mock_packages):
working_dir = tmpdir.join('working_dir') working_dir = tmpdir.join('working_dir')
mirror_dir = working_dir.join('mirror') mirror_dir = working_dir.join('mirror')

View file

@ -2,6 +2,9 @@
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest
from spack.main import SpackCommand from spack.main import SpackCommand
@ -11,6 +14,7 @@
extensions = SpackCommand('extensions') extensions = SpackCommand('extensions')
@pytest.mark.skipif(sys.platform == 'win32', reason="Hangs on windows")
def test_activate( def test_activate(
mock_packages, mock_archive, mock_fetch, config, mock_packages, mock_archive, mock_fetch, config,
install_mockery): install_mockery):
@ -20,6 +24,7 @@ def test_activate(
assert 'extension1' in output assert 'extension1' in output
@pytest.mark.skipif(sys.platform == 'win32', reason="Hangs on windows")
def test_deactivate( def test_deactivate(
mock_packages, mock_archive, mock_fetch, config, mock_packages, mock_archive, mock_fetch, config,
install_mockery): install_mockery):
@ -30,6 +35,7 @@ def test_deactivate(
assert 'extension1' not in output assert 'extension1' not in output
@pytest.mark.skipif(sys.platform == 'win32', reason="Hangs on windows")
def test_deactivate_all( def test_deactivate_all(
mock_packages, mock_archive, mock_fetch, config, mock_packages, mock_archive, mock_fetch, config,
install_mockery): install_mockery):

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os import os
import sys
import pytest import pytest
@ -104,6 +105,7 @@ def _run_analyzer(name, package, tmpdir):
return output_file return output_file
@pytest.mark.skipif(sys.platform == 'win32', reason="Install hangs on windows")
def test_installfiles_analyzer(tmpdir, mock_fetch, install_mockery_mutable_config): def test_installfiles_analyzer(tmpdir, mock_fetch, install_mockery_mutable_config):
""" """
test the install files analyzer test the install files analyzer
@ -124,6 +126,7 @@ def test_installfiles_analyzer(tmpdir, mock_fetch, install_mockery_mutable_confi
assert key in basenames assert key in basenames
@pytest.mark.skipif(sys.platform == 'win32', reason="Install hangs on windows")
def test_environment_analyzer(tmpdir, mock_fetch, install_mockery_mutable_config): def test_environment_analyzer(tmpdir, mock_fetch, install_mockery_mutable_config):
""" """
test the environment variables analyzer. test the environment variables analyzer.

View file

@ -3,6 +3,8 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest import pytest
from llnl.util.filesystem import working_dir from llnl.util.filesystem import working_dir
@ -36,6 +38,8 @@ def test_blame_by_percent(mock_packages):
assert 'EMAIL' in out assert 'EMAIL' in out
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_blame_file(mock_packages): def test_blame_file(mock_packages):
"""Sanity check the blame command to make sure it works.""" """Sanity check the blame command to make sure it works."""
with working_dir(spack.paths.prefix): with working_dir(spack.paths.prefix):
@ -68,6 +72,7 @@ def test_blame_json(mock_packages):
assert key in loaded['authors'][0] assert key in loaded['authors'][0]
@pytest.mark.skipif(sys.platform == 'win32', reason="git hangs")
def test_blame_by_git(mock_packages, capfd): def test_blame_by_git(mock_packages, capfd):
"""Sanity check the blame command to make sure it works.""" """Sanity check the blame command to make sure it works."""
with capfd.disabled(): with capfd.disabled():

View file

@ -3,6 +3,7 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os.path import os.path
import sys
import pytest import pytest
@ -38,6 +39,8 @@ def test_root_get_and_set(mutable_config, scope):
_bootstrap('root', path, *scope_args) _bootstrap('root', path, *scope_args)
out = _bootstrap('root', *scope_args, output=str) out = _bootstrap('root', *scope_args, output=str)
if sys.platform == 'win32':
out = out.replace("\\", "/")
assert out.strip() == path assert out.strip() == path

View file

@ -7,6 +7,7 @@
import os import os
import platform import platform
import shutil import shutil
import sys
import pytest import pytest
@ -57,6 +58,7 @@ def test_buildcache_preview_just_runs(database):
buildcache('preview', 'mpileaks') buildcache('preview', 'mpileaks')
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
@pytest.mark.db @pytest.mark.db
@pytest.mark.regression('13757') @pytest.mark.regression('13757')
def test_buildcache_list_duplicates(mock_get_specs, capsys): def test_buildcache_list_duplicates(mock_get_specs, capsys):
@ -66,6 +68,7 @@ def test_buildcache_list_duplicates(mock_get_specs, capsys):
assert output.count('mpileaks') == 3 assert output.count('mpileaks') == 3
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
@pytest.mark.db @pytest.mark.db
@pytest.mark.regression('17827') @pytest.mark.regression('17827')
def test_buildcache_list_allarch(database, mock_get_specs_multiarch, capsys): def test_buildcache_list_allarch(database, mock_get_specs_multiarch, capsys):
@ -80,6 +83,7 @@ def test_buildcache_list_allarch(database, mock_get_specs_multiarch, capsys):
assert output.count('mpileaks') == 2 assert output.count('mpileaks') == 2
@pytest.mark.skipif(sys.platform == 'win32', reason="Install hangs on windows")
def tests_buildcache_create( def tests_buildcache_create(
install_mockery, mock_fetch, monkeypatch, tmpdir): install_mockery, mock_fetch, monkeypatch, tmpdir):
""""Ensure that buildcache create creates output files""" """"Ensure that buildcache create creates output files"""
@ -97,6 +101,7 @@ def tests_buildcache_create(
os.path.join(str(tmpdir), 'build_cache', tarball)) os.path.join(str(tmpdir), 'build_cache', tarball))
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def tests_buildcache_create_env( def tests_buildcache_create_env(
install_mockery, mock_fetch, monkeypatch, install_mockery, mock_fetch, monkeypatch,
tmpdir, mutable_mock_env_path): tmpdir, mutable_mock_env_path):
@ -119,6 +124,7 @@ def tests_buildcache_create_env(
os.path.join(str(tmpdir), 'build_cache', tarball)) os.path.join(str(tmpdir), 'build_cache', tarball))
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_buildcache_create_fails_on_noargs(tmpdir): def test_buildcache_create_fails_on_noargs(tmpdir):
"""Ensure that buildcache create fails when given no args or """Ensure that buildcache create fails when given no args or
environment.""" environment."""
@ -126,6 +132,7 @@ def test_buildcache_create_fails_on_noargs(tmpdir):
buildcache('create', '-d', str(tmpdir), '--unsigned') buildcache('create', '-d', str(tmpdir), '--unsigned')
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_buildcache_create_fail_on_perm_denied( def test_buildcache_create_fail_on_perm_denied(
install_mockery, mock_fetch, monkeypatch, tmpdir): install_mockery, mock_fetch, monkeypatch, tmpdir):
"""Ensure that buildcache create fails on permission denied error.""" """Ensure that buildcache create fails on permission denied error."""
@ -139,6 +146,7 @@ def test_buildcache_create_fail_on_perm_denied(
tmpdir.chmod(0o700) tmpdir.chmod(0o700)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_update_key_index(tmpdir, mutable_mock_env_path, def test_update_key_index(tmpdir, mutable_mock_env_path,
install_mockery, mock_packages, mock_fetch, install_mockery, mock_packages, mock_fetch,
mock_stage, mock_gnupghome): mock_stage, mock_gnupghome):
@ -175,6 +183,7 @@ def test_update_key_index(tmpdir, mutable_mock_env_path,
assert 'index.json' in key_dir_list assert 'index.json' in key_dir_list
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_buildcache_sync(mutable_mock_env_path, install_mockery_mutable_config, def test_buildcache_sync(mutable_mock_env_path, install_mockery_mutable_config,
mock_packages, mock_fetch, mock_stage, tmpdir): mock_packages, mock_fetch, mock_stage, tmpdir):
""" """
@ -251,6 +260,7 @@ def verify_mirror_contents():
verify_mirror_contents() verify_mirror_contents()
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_buildcache_create_install(mutable_mock_env_path, def test_buildcache_create_install(mutable_mock_env_path,
install_mockery_mutable_config, install_mockery_mutable_config,
mock_packages, mock_fetch, mock_stage, mock_packages, mock_fetch, mock_stage,

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import argparse import argparse
import sys
import pytest import pytest
@ -29,6 +30,8 @@ def test_checksum_args(arguments, expected):
assert check == expected assert check == expected
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize('arguments,expected', [ @pytest.mark.parametrize('arguments,expected', [
(['--batch', 'preferred-test'], 'version of preferred-test'), (['--batch', 'preferred-test'], 'version of preferred-test'),
(['--latest', 'preferred-test'], 'Found 1 version'), (['--latest', 'preferred-test'], 'Found 1 version'),
@ -40,6 +43,8 @@ def test_checksum(arguments, expected, mock_packages, mock_stage):
assert 'version(' in output assert 'version(' in output
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_checksum_interactive( def test_checksum_interactive(
mock_packages, mock_fetch, mock_stage, monkeypatch): mock_packages, mock_fetch, mock_stage, monkeypatch):
def _get_number(*args, **kwargs): def _get_number(*args, **kwargs):

View file

@ -7,6 +7,7 @@
import json import json
import os import os
import shutil import shutil
import sys
import pytest import pytest
from jsonschema import ValidationError, validate from jsonschema import ValidationError, validate
@ -58,6 +59,7 @@ def set_env_var(key, val):
os.environ[key] = val os.environ[key] = val
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_specs_staging(config): def test_specs_staging(config):
"""Make sure we achieve the best possible staging for the following """Make sure we achieve the best possible staging for the following
spec DAG:: spec DAG::
@ -117,6 +119,7 @@ def test_specs_staging(config):
assert (spec_a_label in stages[3]) assert (spec_a_label in stages[3])
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_ci_generate_with_env(tmpdir, mutable_mock_env_path, def test_ci_generate_with_env(tmpdir, mutable_mock_env_path,
install_mockery, mock_packages, project_dir_env, install_mockery, mock_packages, project_dir_env,
mock_binary_index): mock_binary_index):
@ -213,6 +216,7 @@ def _validate_needs_graph(yaml_contents, needs_graph, artifacts):
break break
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_ci_generate_bootstrap_gcc(tmpdir, mutable_mock_env_path, def test_ci_generate_bootstrap_gcc(tmpdir, mutable_mock_env_path,
install_mockery, install_mockery,
mock_packages, project_dir_env): mock_packages, project_dir_env):
@ -275,6 +279,7 @@ def test_ci_generate_bootstrap_gcc(tmpdir, mutable_mock_env_path,
_validate_needs_graph(yaml_contents, needs_graph, False) _validate_needs_graph(yaml_contents, needs_graph, False)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_ci_generate_bootstrap_artifacts_buildcache(tmpdir, def test_ci_generate_bootstrap_artifacts_buildcache(tmpdir,
mutable_mock_env_path, mutable_mock_env_path,
install_mockery, install_mockery,
@ -342,6 +347,7 @@ def test_ci_generate_bootstrap_artifacts_buildcache(tmpdir,
_validate_needs_graph(yaml_contents, needs_graph, True) _validate_needs_graph(yaml_contents, needs_graph, True)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_ci_generate_with_env_missing_section(tmpdir, mutable_mock_env_path, def test_ci_generate_with_env_missing_section(tmpdir, mutable_mock_env_path,
install_mockery, install_mockery,
mock_packages, project_dir_env, mock_packages, project_dir_env,
@ -368,6 +374,7 @@ def test_ci_generate_with_env_missing_section(tmpdir, mutable_mock_env_path,
assert(expect_out in output) assert(expect_out in output)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_ci_generate_with_cdash_token(tmpdir, mutable_mock_env_path, def test_ci_generate_with_cdash_token(tmpdir, mutable_mock_env_path,
install_mockery, install_mockery,
mock_packages, project_dir_env, mock_packages, project_dir_env,
@ -424,6 +431,7 @@ def test_ci_generate_with_cdash_token(tmpdir, mutable_mock_env_path,
assert(filecmp.cmp(orig_file, copy_to_file) is True) assert(filecmp.cmp(orig_file, copy_to_file) is True)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_ci_generate_with_custom_scripts(tmpdir, mutable_mock_env_path, def test_ci_generate_with_custom_scripts(tmpdir, mutable_mock_env_path,
install_mockery, install_mockery,
mock_packages, monkeypatch, mock_packages, monkeypatch,
@ -515,6 +523,7 @@ def test_ci_generate_with_custom_scripts(tmpdir, mutable_mock_env_path,
assert(found_it) assert(found_it)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_ci_generate_pkg_with_deps(tmpdir, mutable_mock_env_path, def test_ci_generate_pkg_with_deps(tmpdir, mutable_mock_env_path,
install_mockery, install_mockery,
mock_packages, project_dir_env): mock_packages, project_dir_env):
@ -569,6 +578,7 @@ def test_ci_generate_pkg_with_deps(tmpdir, mutable_mock_env_path,
assert('dependency-install' in found) assert('dependency-install' in found)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_ci_generate_for_pr_pipeline(tmpdir, mutable_mock_env_path, def test_ci_generate_for_pr_pipeline(tmpdir, mutable_mock_env_path,
install_mockery, install_mockery,
mock_packages, monkeypatch, mock_packages, monkeypatch,
@ -633,6 +643,7 @@ def test_ci_generate_for_pr_pipeline(tmpdir, mutable_mock_env_path,
assert(pipeline_vars['SPACK_PIPELINE_TYPE'] == 'spack_pull_request') assert(pipeline_vars['SPACK_PIPELINE_TYPE'] == 'spack_pull_request')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_ci_generate_with_external_pkg(tmpdir, mutable_mock_env_path, def test_ci_generate_with_external_pkg(tmpdir, mutable_mock_env_path,
install_mockery, install_mockery,
mock_packages, monkeypatch, mock_packages, monkeypatch,
@ -678,6 +689,7 @@ def test_ci_generate_with_external_pkg(tmpdir, mutable_mock_env_path,
@pytest.mark.xfail(reason='fails intermittently and covered by gitlab ci') @pytest.mark.xfail(reason='fails intermittently and covered by gitlab ci')
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_ci_rebuild(tmpdir, mutable_mock_env_path, def test_ci_rebuild(tmpdir, mutable_mock_env_path,
install_mockery, mock_packages, monkeypatch, install_mockery, mock_packages, monkeypatch,
mock_gnupghome, mock_fetch, project_dir_env, mock_gnupghome, mock_fetch, project_dir_env,
@ -837,6 +849,7 @@ def mystrip(s):
env_cmd('deactivate') env_cmd('deactivate')
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_ci_nothing_to_rebuild(tmpdir, mutable_mock_env_path, def test_ci_nothing_to_rebuild(tmpdir, mutable_mock_env_path,
install_mockery, mock_packages, monkeypatch, install_mockery, mock_packages, monkeypatch,
mock_fetch, project_dir_env, mock_binary_index): mock_fetch, project_dir_env, mock_binary_index):
@ -911,6 +924,7 @@ def fake_dl_method(spec, *args, **kwargs):
env_cmd('deactivate') env_cmd('deactivate')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_push_mirror_contents(tmpdir, mutable_mock_env_path, def test_push_mirror_contents(tmpdir, mutable_mock_env_path,
install_mockery_mutable_config, mock_packages, install_mockery_mutable_config, mock_packages,
@ -1061,6 +1075,7 @@ def test_push_mirror_contents(tmpdir, mutable_mock_env_path,
assert(len(dl_dir_list) == 3) assert(len(dl_dir_list) == 3)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_push_mirror_contents_exceptions(monkeypatch, capsys): def test_push_mirror_contents_exceptions(monkeypatch, capsys):
def failing_access(*args, **kwargs): def failing_access(*args, **kwargs):
raise Exception('Error: Access Denied') raise Exception('Error: Access Denied')
@ -1078,6 +1093,7 @@ def failing_access(*args, **kwargs):
assert expect_msg in std_out assert expect_msg in std_out
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_ci_generate_override_runner_attrs(tmpdir, mutable_mock_env_path, def test_ci_generate_override_runner_attrs(tmpdir, mutable_mock_env_path,
install_mockery, install_mockery,
mock_packages, monkeypatch, mock_packages, monkeypatch,
@ -1223,6 +1239,7 @@ def test_ci_generate_override_runner_attrs(tmpdir, mutable_mock_env_path,
assert(the_elt['after_script'][0] == 'post step one') assert(the_elt['after_script'][0] == 'post step one')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_ci_generate_with_workarounds(tmpdir, mutable_mock_env_path, def test_ci_generate_with_workarounds(tmpdir, mutable_mock_env_path,
install_mockery, install_mockery,
mock_packages, monkeypatch, mock_packages, monkeypatch,
@ -1274,6 +1291,7 @@ def test_ci_generate_with_workarounds(tmpdir, mutable_mock_env_path,
assert(found_one is True) assert(found_one is True)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_ci_rebuild_index(tmpdir, mutable_mock_env_path, def test_ci_rebuild_index(tmpdir, mutable_mock_env_path,
install_mockery, mock_packages, mock_fetch, install_mockery, mock_packages, mock_fetch,
@ -1326,6 +1344,7 @@ def test_ci_rebuild_index(tmpdir, mutable_mock_env_path,
validate(index_object, db_idx_schema) validate(index_object, db_idx_schema)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_ci_generate_bootstrap_prune_dag( def test_ci_generate_bootstrap_prune_dag(
install_mockery_mutable_config, mock_packages, mock_fetch, install_mockery_mutable_config, mock_packages, mock_fetch,
mock_archive, mutable_config, monkeypatch, tmpdir, mock_archive, mutable_config, monkeypatch, tmpdir,
@ -1460,6 +1479,7 @@ def fake_get_mirrors_for_spec(spec=None, full_hash_match=False,
_validate_needs_graph(new_yaml_contents, needs_graph, False) _validate_needs_graph(new_yaml_contents, needs_graph, False)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_ci_subcommands_without_mirror(tmpdir, mutable_mock_env_path, def test_ci_subcommands_without_mirror(tmpdir, mutable_mock_env_path,
mock_packages, mock_packages,
install_mockery, project_dir_env, install_mockery, project_dir_env,
@ -1499,6 +1519,7 @@ def test_ci_subcommands_without_mirror(tmpdir, mutable_mock_env_path,
assert(ex in output) assert(ex in output)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_ensure_only_one_temporary_storage(): def test_ensure_only_one_temporary_storage():
"""Make sure 'gitlab-ci' section of env does not allow specification of """Make sure 'gitlab-ci' section of env does not allow specification of
both 'enable-artifacts-buildcache' and 'temporary-storage-url-prefix'.""" both 'enable-artifacts-buildcache' and 'temporary-storage-url-prefix'."""
@ -1539,6 +1560,7 @@ def test_ensure_only_one_temporary_storage():
validate(yaml_obj, gitlab_ci_schema) validate(yaml_obj, gitlab_ci_schema)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_ci_generate_temp_storage_url(tmpdir, mutable_mock_env_path, def test_ci_generate_temp_storage_url(tmpdir, mutable_mock_env_path,
install_mockery, install_mockery,
mock_packages, monkeypatch, mock_packages, monkeypatch,
@ -1595,6 +1617,7 @@ def test_ci_generate_temp_storage_url(tmpdir, mutable_mock_env_path,
assert(cleanup_job['stage'] == stages[-2]) assert(cleanup_job['stage'] == stages[-2])
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_ci_generate_read_broken_specs_url(tmpdir, mutable_mock_env_path, def test_ci_generate_read_broken_specs_url(tmpdir, mutable_mock_env_path,
install_mockery, install_mockery,
mock_packages, monkeypatch, mock_packages, monkeypatch,
@ -1654,6 +1677,7 @@ def test_ci_generate_read_broken_specs_url(tmpdir, mutable_mock_env_path,
assert(ex not in output) assert(ex not in output)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_ci_reproduce(tmpdir, mutable_mock_env_path, def test_ci_reproduce(tmpdir, mutable_mock_env_path,
install_mockery, mock_packages, monkeypatch, install_mockery, mock_packages, monkeypatch,
last_two_git_commits, project_dir_env, mock_binary_index): last_two_git_commits, project_dir_env, mock_binary_index):

View file

@ -3,6 +3,8 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest import pytest
import spack.caches import spack.caches
@ -55,6 +57,7 @@ def __call__(self, *args, **kwargs):
('-a', all_effects), ('-a', all_effects),
('', []), ('', []),
]) ])
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_function_calls(command_line, effects, mock_calls_for_clean): def test_function_calls(command_line, effects, mock_calls_for_clean):
# Call the command with the supplied command line # Call the command with the supplied command line

View file

@ -7,6 +7,7 @@
import os import os
import shutil import shutil
import subprocess import subprocess
import sys
import pytest import pytest
@ -215,6 +216,7 @@ def test_update_completion_arg(tmpdir, monkeypatch):
assert "--update-completion" in mock_bashfile.read() assert "--update-completion" in mock_bashfile.read()
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_updated_completion_scripts(tmpdir): def test_updated_completion_scripts(tmpdir):
"""Make sure our shell tab completion scripts remain up-to-date.""" """Make sure our shell tab completion scripts remain up-to-date."""

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import argparse import argparse
import sys
import pytest import pytest
@ -62,6 +63,8 @@ def test_parse_spec_flags_with_spaces(
assert all(x in s.variants for x in expected_variants) assert all(x in s.variants for x in expected_variants)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.usefixtures('config') @pytest.mark.usefixtures('config')
def test_match_spec_env(mock_packages, mutable_mock_env_path): def test_match_spec_env(mock_packages, mutable_mock_env_path):
""" """
@ -84,6 +87,8 @@ def test_match_spec_env(mock_packages, mutable_mock_env_path):
assert env_spec.concrete assert env_spec.concrete
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.usefixtures('config') @pytest.mark.usefixtures('config')
def test_multiple_env_match_raises_error(mock_packages, mutable_mock_env_path): def test_multiple_env_match_raises_error(mock_packages, mutable_mock_env_path):
e = ev.create('test') e = ev.create('test')
@ -97,6 +102,8 @@ def test_multiple_env_match_raises_error(mock_packages, mutable_mock_env_path):
assert 'matches multiple specs' in exc_info.value.message assert 'matches multiple specs' in exc_info.value.message
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.usefixtures('config') @pytest.mark.usefixtures('config')
def test_root_and_dep_match_returns_root(mock_packages, mutable_mock_env_path): def test_root_and_dep_match_returns_root(mock_packages, mutable_mock_env_path):
e = ev.create('test') e = ev.create('test')

View file

@ -51,6 +51,7 @@ def mock_compiler_dir(tmpdir, mock_compiler_version):
return str(tmpdir) return str(tmpdir)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.regression('11678,13138') @pytest.mark.regression('11678,13138')
def test_compiler_find_without_paths(no_compilers_yaml, working_env, tmpdir): def test_compiler_find_without_paths(no_compilers_yaml, working_env, tmpdir):
with tmpdir.as_cwd(): with tmpdir.as_cwd():
@ -103,6 +104,7 @@ def test_compiler_remove(mutable_config, mock_packages):
assert spack.spec.CompilerSpec("gcc@4.5.0") not in compilers assert spack.spec.CompilerSpec("gcc@4.5.0") not in compilers
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_compiler_add( def test_compiler_add(
mutable_config, mock_packages, mock_compiler_dir, mock_compiler_version mutable_config, mock_packages, mock_compiler_dir, mock_compiler_version
): ):
@ -182,6 +184,7 @@ def clangdir(tmpdir):
yield tmpdir yield tmpdir
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.regression('17590') @pytest.mark.regression('17590')
def test_compiler_find_mixed_suffixes( def test_compiler_find_mixed_suffixes(
no_compilers_yaml, working_env, clangdir): no_compilers_yaml, working_env, clangdir):
@ -217,6 +220,7 @@ def test_compiler_find_mixed_suffixes(
} }
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.regression('17590') @pytest.mark.regression('17590')
def test_compiler_find_prefer_no_suffix( def test_compiler_find_prefer_no_suffix(
no_compilers_yaml, working_env, clangdir): no_compilers_yaml, working_env, clangdir):
@ -242,6 +246,7 @@ def test_compiler_find_prefer_no_suffix(
assert clang['paths']['cxx'] == str(clangdir.join('clang++')) assert clang['paths']['cxx'] == str(clangdir.join('clang++'))
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_compiler_find_path_order( def test_compiler_find_path_order(
no_compilers_yaml, working_env, clangdir): no_compilers_yaml, working_env, clangdir):
"""Ensure that we find compilers that come first in the PATH first """Ensure that we find compilers that come first in the PATH first

View file

@ -3,6 +3,7 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest import pytest
@ -18,6 +19,7 @@
concretize = SpackCommand('concretize') concretize = SpackCommand('concretize')
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
@pytest.mark.parametrize('concretization', ['separately', 'together']) @pytest.mark.parametrize('concretization', ['separately', 'together'])
def test_concretize_all_test_dependencies(concretization): def test_concretize_all_test_dependencies(concretization):
"""Check all test dependencies are concretized.""" """Check all test dependencies are concretized."""
@ -30,6 +32,7 @@ def test_concretize_all_test_dependencies(concretization):
assert e.matching_spec('test-dependency') assert e.matching_spec('test-dependency')
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
@pytest.mark.parametrize('concretization', ['separately', 'together']) @pytest.mark.parametrize('concretization', ['separately', 'together'])
def test_concretize_root_test_dependencies_not_recursive(concretization): def test_concretize_root_test_dependencies_not_recursive(concretization):
"""Check that test dependencies are not concretized recursively.""" """Check that test dependencies are not concretized recursively."""
@ -42,6 +45,7 @@ def test_concretize_root_test_dependencies_not_recursive(concretization):
assert e.matching_spec('test-dependency') is None assert e.matching_spec('test-dependency') is None
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
@pytest.mark.parametrize('concretization', ['separately', 'together']) @pytest.mark.parametrize('concretization', ['separately', 'together'])
def test_concretize_root_test_dependencies_are_concretized(concretization): def test_concretize_root_test_dependencies_are_concretized(concretization):
"""Check that root test dependencies are concretized.""" """Check that root test dependencies are concretized."""

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import functools import functools
import os import os
import sys
import pytest import pytest
@ -239,6 +240,7 @@ def test_config_add_ordered_dict(mutable_empty_config):
""" """
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_config_add_invalid_fails(mutable_empty_config): def test_config_add_invalid_fails(mutable_empty_config):
config('add', 'packages:all:variants:+debug') config('add', 'packages:all:variants:+debug')
with pytest.raises( with pytest.raises(
@ -247,6 +249,7 @@ def test_config_add_invalid_fails(mutable_empty_config):
config('add', 'packages:all:True') config('add', 'packages:all:True')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_config_add_from_file(mutable_empty_config, tmpdir): def test_config_add_from_file(mutable_empty_config, tmpdir):
contents = """spack: contents = """spack:
config: config:
@ -264,6 +267,7 @@ def test_config_add_from_file(mutable_empty_config, tmpdir):
""" """
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_config_add_from_file_multiple(mutable_empty_config, tmpdir): def test_config_add_from_file_multiple(mutable_empty_config, tmpdir):
contents = """spack: contents = """spack:
config: config:
@ -319,6 +323,7 @@ def test_config_add_override_leaf_from_file(mutable_empty_config, tmpdir):
""" """
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_config_add_update_dict_from_file(mutable_empty_config, tmpdir): def test_config_add_update_dict_from_file(mutable_empty_config, tmpdir):
config('add', 'packages:all:compiler:[gcc]') config('add', 'packages:all:compiler:[gcc]')
@ -370,6 +375,7 @@ def test_config_add_invalid_file_fails(tmpdir):
config('add', '-f', file) config('add', '-f', file)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_config_remove_value(mutable_empty_config): def test_config_remove_value(mutable_empty_config):
config('add', 'config:dirty:true') config('add', 'config:dirty:true')
config('remove', 'config:dirty:true') config('remove', 'config:dirty:true')
@ -379,6 +385,7 @@ def test_config_remove_value(mutable_empty_config):
""" """
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_config_remove_alias_rm(mutable_empty_config): def test_config_remove_alias_rm(mutable_empty_config):
config('add', 'config:dirty:true') config('add', 'config:dirty:true')
config('rm', 'config:dirty:true') config('rm', 'config:dirty:true')
@ -388,6 +395,7 @@ def test_config_remove_alias_rm(mutable_empty_config):
""" """
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_config_remove_dict(mutable_empty_config): def test_config_remove_dict(mutable_empty_config):
config('add', 'config:dirty:true') config('add', 'config:dirty:true')
config('rm', 'config:dirty') config('rm', 'config:dirty')
@ -397,6 +405,7 @@ def test_config_remove_dict(mutable_empty_config):
""" """
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_remove_from_list(mutable_empty_config): def test_remove_from_list(mutable_empty_config):
config('add', 'config:template_dirs:test1') config('add', 'config:template_dirs:test1')
config('add', 'config:template_dirs:[test2]') config('add', 'config:template_dirs:[test2]')
@ -411,6 +420,7 @@ def test_remove_from_list(mutable_empty_config):
""" """
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_remove_list(mutable_empty_config): def test_remove_list(mutable_empty_config):
config('add', 'config:template_dirs:test1') config('add', 'config:template_dirs:test1')
config('add', 'config:template_dirs:[test2]') config('add', 'config:template_dirs:[test2]')
@ -425,6 +435,7 @@ def test_remove_list(mutable_empty_config):
""" """
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_config_add_to_env(mutable_empty_config, mutable_mock_env_path): def test_config_add_to_env(mutable_empty_config, mutable_mock_env_path):
ev.create('test') ev.create('test')
with ev.read('test'): with ev.read('test'):
@ -438,6 +449,7 @@ def test_config_add_to_env(mutable_empty_config, mutable_mock_env_path):
assert expected in output assert expected in output
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_config_add_to_env_preserve_comments(mutable_empty_config, def test_config_add_to_env_preserve_comments(mutable_empty_config,
mutable_mock_env_path, mutable_mock_env_path,
tmpdir): tmpdir):
@ -470,6 +482,7 @@ def test_config_add_to_env_preserve_comments(mutable_empty_config,
assert output == expected assert output == expected
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_config_remove_from_env(mutable_empty_config, mutable_mock_env_path): def test_config_remove_from_env(mutable_empty_config, mutable_mock_env_path):
env('create', 'test') env('create', 'test')
@ -487,6 +500,7 @@ def test_config_remove_from_env(mutable_empty_config, mutable_mock_env_path):
assert output == expected assert output == expected
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_config_update_packages(packages_yaml_v015): def test_config_update_packages(packages_yaml_v015):
"""Test Spack updating old packages.yaml format for externals """Test Spack updating old packages.yaml format for externals
to new format. Ensure that data is preserved and converted to new format. Ensure that data is preserved and converted
@ -500,6 +514,7 @@ def test_config_update_packages(packages_yaml_v015):
check_packages_updated(data) check_packages_updated(data)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_config_update_config(config_yaml_v015): def test_config_update_config(config_yaml_v015):
config_yaml_v015() config_yaml_v015()
config('update', '-y', 'config') config('update', '-y', 'config')
@ -509,6 +524,7 @@ def test_config_update_config(config_yaml_v015):
check_config_updated(data) check_config_updated(data)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_config_update_not_needed(mutable_config): def test_config_update_not_needed(mutable_config):
data_before = spack.config.get('repos') data_before = spack.config.get('repos')
config('update', '-y', 'repos') config('update', '-y', 'repos')
@ -516,6 +532,7 @@ def test_config_update_not_needed(mutable_config):
assert data_before == data_after assert data_before == data_after
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_config_update_fail_on_permission_issue( def test_config_update_fail_on_permission_issue(
packages_yaml_v015, monkeypatch packages_yaml_v015, monkeypatch
): ):
@ -529,6 +546,7 @@ def test_config_update_fail_on_permission_issue(
config('update', '-y', 'packages') config('update', '-y', 'packages')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_config_revert(packages_yaml_v015): def test_config_revert(packages_yaml_v015):
cfg_file = packages_yaml_v015() cfg_file = packages_yaml_v015()
bkp_file = cfg_file + '.bkp' bkp_file = cfg_file + '.bkp'

View file

@ -6,6 +6,7 @@
import os import os
import os.path import os.path
import platform import platform
import sys
import pytest import pytest
@ -17,6 +18,7 @@
debug = SpackCommand('debug') debug = SpackCommand('debug')
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
@pytest.mark.db @pytest.mark.db
def test_create_db_tarball(tmpdir, database): def test_create_db_tarball(tmpdir, database):
with tmpdir.as_cwd(): with tmpdir.as_cwd():
@ -46,6 +48,7 @@ def test_create_db_tarball(tmpdir, database):
assert spec_suffix in contents assert spec_suffix in contents
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_report(): def test_report():
out = debug('report') out = debug('report')
host_platform = spack.platforms.host() host_platform = spack.platforms.host()

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import re import re
import sys
import pytest import pytest
@ -20,6 +21,7 @@
mpi_deps = ['fake'] mpi_deps = ['fake']
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_direct_dependencies(mock_packages): def test_direct_dependencies(mock_packages):
out = dependencies('mpileaks') out = dependencies('mpileaks')
actual = set(re.split(r'\s+', out.strip())) actual = set(re.split(r'\s+', out.strip()))
@ -27,6 +29,7 @@ def test_direct_dependencies(mock_packages):
assert expected == actual assert expected == actual
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_transitive_dependencies(mock_packages): def test_transitive_dependencies(mock_packages):
out = dependencies('--transitive', 'mpileaks') out = dependencies('--transitive', 'mpileaks')
actual = set(re.split(r'\s+', out.strip())) actual = set(re.split(r'\s+', out.strip()))
@ -35,6 +38,7 @@ def test_transitive_dependencies(mock_packages):
assert expected == actual assert expected == actual
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_transitive_dependencies_with_deptypes(mock_packages): def test_transitive_dependencies_with_deptypes(mock_packages):
out = dependencies('--transitive', '--deptype=link,run', 'dtbuild1') out = dependencies('--transitive', '--deptype=link,run', 'dtbuild1')
deps = set(re.split(r'\s+', out.strip())) deps = set(re.split(r'\s+', out.strip()))
@ -49,6 +53,7 @@ def test_transitive_dependencies_with_deptypes(mock_packages):
assert set(['dtlink2']) == deps assert set(['dtlink2']) == deps
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
@pytest.mark.db @pytest.mark.db
def test_direct_installed_dependencies(mock_packages, database): def test_direct_installed_dependencies(mock_packages, database):
with color_when(False): with color_when(False):
@ -66,6 +71,7 @@ def test_direct_installed_dependencies(mock_packages, database):
assert expected == hashes assert expected == hashes
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
@pytest.mark.db @pytest.mark.db
def test_transitive_installed_dependencies(mock_packages, database): def test_transitive_installed_dependencies(mock_packages, database):
with color_when(False): with color_when(False):

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import re import re
import sys
import pytest import pytest
@ -15,6 +16,7 @@
dependents = SpackCommand('dependents') dependents = SpackCommand('dependents')
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_immediate_dependents(mock_packages): def test_immediate_dependents(mock_packages):
out = dependents('libelf') out = dependents('libelf')
actual = set(re.split(r'\s+', out.strip())) actual = set(re.split(r'\s+', out.strip()))
@ -28,6 +30,7 @@ def test_immediate_dependents(mock_packages):
]) ])
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_transitive_dependents(mock_packages): def test_transitive_dependents(mock_packages):
out = dependents('--transitive', 'libelf') out = dependents('--transitive', 'libelf')
actual = set(re.split(r'\s+', out.strip())) actual = set(re.split(r'\s+', out.strip()))
@ -44,6 +47,7 @@ def test_transitive_dependents(mock_packages):
]) ])
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
@pytest.mark.db @pytest.mark.db
def test_immediate_installed_dependents(mock_packages, database): def test_immediate_installed_dependents(mock_packages, database):
with color_when(False): with color_when(False):
@ -61,6 +65,7 @@ def test_immediate_installed_dependents(mock_packages, database):
assert expected == hashes assert expected == hashes
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
@pytest.mark.db @pytest.mark.db
def test_transitive_installed_dependents(mock_packages, database): def test_transitive_installed_dependents(mock_packages, database):
with color_when(False): with color_when(False):

View file

@ -2,6 +2,9 @@
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest import pytest
import spack.store import spack.store
@ -15,6 +18,7 @@
activate = SpackCommand('activate') activate = SpackCommand('activate')
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_deprecate(mock_packages, mock_archive, mock_fetch, install_mockery): def test_deprecate(mock_packages, mock_archive, mock_fetch, install_mockery):
install('libelf@0.8.13') install('libelf@0.8.13')
install('libelf@0.8.10') install('libelf@0.8.10')
@ -30,6 +34,7 @@ def test_deprecate(mock_packages, mock_archive, mock_fetch, install_mockery):
assert non_deprecated == spack.store.db.query('libelf@0.8.13') assert non_deprecated == spack.store.db.query('libelf@0.8.13')
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_deprecate_fails_no_such_package(mock_packages, mock_archive, def test_deprecate_fails_no_such_package(mock_packages, mock_archive,
mock_fetch, install_mockery): mock_fetch, install_mockery):
"""Tests that deprecating a spec that is not installed fails. """Tests that deprecating a spec that is not installed fails.
@ -47,6 +52,7 @@ def test_deprecate_fails_no_such_package(mock_packages, mock_archive,
assert "Spec 'libelf@0.8.13' matches no installed packages" in output assert "Spec 'libelf@0.8.13' matches no installed packages" in output
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_deprecate_install(mock_packages, mock_archive, mock_fetch, def test_deprecate_install(mock_packages, mock_archive, mock_fetch,
install_mockery): install_mockery):
"""Tests that the ```-i`` option allows us to deprecate in favor of a spec """Tests that the ```-i`` option allows us to deprecate in favor of a spec
@ -65,6 +71,7 @@ def test_deprecate_install(mock_packages, mock_archive, mock_fetch,
assert non_deprecated[0].satisfies('libelf@0.8.13') assert non_deprecated[0].satisfies('libelf@0.8.13')
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_deprecate_deps(mock_packages, mock_archive, mock_fetch, def test_deprecate_deps(mock_packages, mock_archive, mock_fetch,
install_mockery): install_mockery):
"""Test that the deprecate command deprecates all dependencies properly.""" """Test that the deprecate command deprecates all dependencies properly."""
@ -89,6 +96,7 @@ def test_deprecate_deps(mock_packages, mock_archive, mock_fetch,
assert sorted(deprecated) == sorted(list(old_spec.traverse())) assert sorted(deprecated) == sorted(list(old_spec.traverse()))
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_deprecate_fails_active_extensions(mock_packages, mock_archive, def test_deprecate_fails_active_extensions(mock_packages, mock_archive,
mock_fetch, install_mockery): mock_fetch, install_mockery):
"""Tests that active extensions and their extendees cannot be """Tests that active extensions and their extendees cannot be
@ -108,6 +116,7 @@ def test_deprecate_fails_active_extensions(mock_packages, mock_archive,
assert 'is an active extension of' in output assert 'is an active extension of' in output
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_uninstall_deprecated(mock_packages, mock_archive, mock_fetch, def test_uninstall_deprecated(mock_packages, mock_archive, mock_fetch,
install_mockery): install_mockery):
"""Tests that we can still uninstall deprecated packages.""" """Tests that we can still uninstall deprecated packages."""
@ -124,6 +133,7 @@ def test_uninstall_deprecated(mock_packages, mock_archive, mock_fetch,
assert spack.store.db.query() == non_deprecated assert spack.store.db.query() == non_deprecated
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_deprecate_already_deprecated(mock_packages, mock_archive, mock_fetch, def test_deprecate_already_deprecated(mock_packages, mock_archive, mock_fetch,
install_mockery): install_mockery):
"""Tests that we can re-deprecate a spec to change its deprecator.""" """Tests that we can re-deprecate a spec to change its deprecator."""
@ -149,6 +159,7 @@ def test_deprecate_already_deprecated(mock_packages, mock_archive, mock_fetch,
assert deprecator == spack.spec.Spec('libelf@0.8.13').concretized() assert deprecator == spack.spec.Spec('libelf@0.8.13').concretized()
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_deprecate_deprecator(mock_packages, mock_archive, mock_fetch, def test_deprecate_deprecator(mock_packages, mock_archive, mock_fetch,
install_mockery): install_mockery):
"""Tests that when a deprecator spec is deprecated, its deprecatee specs """Tests that when a deprecator spec is deprecated, its deprecatee specs
@ -179,6 +190,7 @@ def test_deprecate_deprecator(mock_packages, mock_archive, mock_fetch,
assert second_deprecator == final_deprecator assert second_deprecator == final_deprecator
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_concretize_deprecated(mock_packages, mock_archive, mock_fetch, def test_concretize_deprecated(mock_packages, mock_archive, mock_fetch,
install_mockery): install_mockery):
"""Tests that the concretizer throws an error if we concretize to a """Tests that the concretizer throws an error if we concretize to a

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os import os
import sys
import pytest import pytest
@ -18,6 +19,7 @@
env = SpackCommand('env') env = SpackCommand('env')
@pytest.mark.skipif(sys.platform == 'win32', reason="Hangs on windows")
def test_dev_build_basics(tmpdir, mock_packages, install_mockery): def test_dev_build_basics(tmpdir, mock_packages, install_mockery):
spec = spack.spec.Spec('dev-build-test-install@0.0.0 dev_path=%s' % tmpdir) spec = spack.spec.Spec('dev-build-test-install@0.0.0 dev_path=%s' % tmpdir)
spec.concretize() spec.concretize()
@ -37,6 +39,7 @@ def test_dev_build_basics(tmpdir, mock_packages, install_mockery):
assert os.path.exists(str(tmpdir)) assert os.path.exists(str(tmpdir))
@pytest.mark.skipif(sys.platform == 'win32', reason="Hangs on windows")
def test_dev_build_before(tmpdir, mock_packages, install_mockery): def test_dev_build_before(tmpdir, mock_packages, install_mockery):
spec = spack.spec.Spec('dev-build-test-install@0.0.0 dev_path=%s' % tmpdir) spec = spack.spec.Spec('dev-build-test-install@0.0.0 dev_path=%s' % tmpdir)
spec.concretize() spec.concretize()
@ -54,6 +57,7 @@ def test_dev_build_before(tmpdir, mock_packages, install_mockery):
assert not os.path.exists(spec.prefix) assert not os.path.exists(spec.prefix)
@pytest.mark.skipif(sys.platform == 'win32', reason="Hangs on windows")
def test_dev_build_until(tmpdir, mock_packages, install_mockery): def test_dev_build_until(tmpdir, mock_packages, install_mockery):
spec = spack.spec.Spec('dev-build-test-install@0.0.0 dev_path=%s' % tmpdir) spec = spack.spec.Spec('dev-build-test-install@0.0.0 dev_path=%s' % tmpdir)
spec.concretize() spec.concretize()
@ -72,6 +76,7 @@ def test_dev_build_until(tmpdir, mock_packages, install_mockery):
assert not spack.store.db.query(spec, installed=True) assert not spack.store.db.query(spec, installed=True)
@pytest.mark.skipif(sys.platform == 'win32', reason="Hangs on windows")
def test_dev_build_until_last_phase(tmpdir, mock_packages, install_mockery): def test_dev_build_until_last_phase(tmpdir, mock_packages, install_mockery):
# Test that we ignore the last_phase argument if it is already last # Test that we ignore the last_phase argument if it is already last
spec = spack.spec.Spec('dev-build-test-install@0.0.0 dev_path=%s' % tmpdir) spec = spack.spec.Spec('dev-build-test-install@0.0.0 dev_path=%s' % tmpdir)
@ -92,6 +97,7 @@ def test_dev_build_until_last_phase(tmpdir, mock_packages, install_mockery):
assert os.path.exists(str(tmpdir)) assert os.path.exists(str(tmpdir))
@pytest.mark.skipif(sys.platform == 'win32', reason="Hangs on windows")
def test_dev_build_before_until(tmpdir, mock_packages, install_mockery, capsys): def test_dev_build_before_until(tmpdir, mock_packages, install_mockery, capsys):
spec = spack.spec.Spec('dev-build-test-install@0.0.0 dev_path=%s' % tmpdir) spec = spack.spec.Spec('dev-build-test-install@0.0.0 dev_path=%s' % tmpdir)
spec.concretize() spec.concretize()
@ -133,6 +139,7 @@ def mock_module_noop(*args):
pass pass
@pytest.mark.skipif(sys.platform == 'win32', reason="Hangs on windows")
def test_dev_build_drop_in(tmpdir, mock_packages, monkeypatch, def test_dev_build_drop_in(tmpdir, mock_packages, monkeypatch,
install_mockery, working_env): install_mockery, working_env):
monkeypatch.setattr(os, 'execvp', print_spack_cc) monkeypatch.setattr(os, 'execvp', print_spack_cc)
@ -145,6 +152,7 @@ def test_dev_build_drop_in(tmpdir, mock_packages, monkeypatch,
assert "lib/spack/env" in output assert "lib/spack/env" in output
@pytest.mark.skipif(sys.platform == 'win32', reason="Hangs on windows")
def test_dev_build_fails_already_installed(tmpdir, mock_packages, def test_dev_build_fails_already_installed(tmpdir, mock_packages,
install_mockery): install_mockery):
spec = spack.spec.Spec('dev-build-test-install@0.0.0 dev_path=%s' % tmpdir) spec = spack.spec.Spec('dev-build-test-install@0.0.0 dev_path=%s' % tmpdir)
@ -179,6 +187,7 @@ def test_dev_build_fails_no_version(mock_packages):
assert 'dev-build spec must have a single, concrete version' in output assert 'dev-build spec must have a single, concrete version' in output
@pytest.mark.skipif(sys.platform == 'win32', reason="Filename/extension is too long")
def test_dev_build_env(tmpdir, mock_packages, install_mockery, def test_dev_build_env(tmpdir, mock_packages, install_mockery,
mutable_mock_env_path): mutable_mock_env_path):
"""Test Spack does dev builds for packages in develop section of env.""" """Test Spack does dev builds for packages in develop section of env."""
@ -216,6 +225,7 @@ def test_dev_build_env(tmpdir, mock_packages, install_mockery,
assert f.read() == spec.package.replacement_string assert f.read() == spec.package.replacement_string
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_dev_build_env_version_mismatch(tmpdir, mock_packages, install_mockery, def test_dev_build_env_version_mismatch(tmpdir, mock_packages, install_mockery,
mutable_mock_env_path): mutable_mock_env_path):
"""Test Spack constraints concretization by develop specs.""" """Test Spack constraints concretization by develop specs."""
@ -249,6 +259,7 @@ def test_dev_build_env_version_mismatch(tmpdir, mock_packages, install_mockery,
install() install()
@pytest.mark.skipif(sys.platform == 'win32', reason="Hangs")
def test_dev_build_multiple(tmpdir, mock_packages, install_mockery, def test_dev_build_multiple(tmpdir, mock_packages, install_mockery,
mutable_mock_env_path, mock_fetch): mutable_mock_env_path, mock_fetch):
"""Test spack install with multiple developer builds""" """Test spack install with multiple developer builds"""
@ -304,6 +315,7 @@ def test_dev_build_multiple(tmpdir, mock_packages, install_mockery,
assert f.read() == spec.package.replacement_string assert f.read() == spec.package.replacement_string
@pytest.mark.skipif(sys.platform == 'win32', reason="Hangs on windows")
def test_dev_build_env_dependency(tmpdir, mock_packages, install_mockery, def test_dev_build_env_dependency(tmpdir, mock_packages, install_mockery,
mock_fetch, mutable_mock_env_path): mock_fetch, mutable_mock_env_path):
""" """
@ -352,6 +364,7 @@ def test_dev_build_env_dependency(tmpdir, mock_packages, install_mockery,
assert spec.satisfies('^dev_path=*') assert spec.satisfies('^dev_path=*')
@pytest.mark.skipif(sys.platform == 'win32', reason="Hangs on windows")
@pytest.mark.parametrize('test_spec', ['dev-build-test-install', @pytest.mark.parametrize('test_spec', ['dev-build-test-install',
'dependent-of-dev-build']) 'dependent-of-dev-build'])
def test_dev_build_rebuild_on_source_changes( def test_dev_build_rebuild_on_source_changes(

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os import os
import shutil import shutil
import sys
import pytest import pytest
@ -40,6 +41,7 @@ def check_develop(self, env, spec, path=None):
else: else:
assert yaml_entry['path'] == path assert yaml_entry['path'] == path
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_develop_no_path_no_clone(self): def test_develop_no_path_no_clone(self):
env('create', 'test') env('create', 'test')
with ev.read('test') as e: with ev.read('test') as e:
@ -48,18 +50,21 @@ def test_develop_no_path_no_clone(self):
develop('--no-clone', 'mpich@1.0') develop('--no-clone', 'mpich@1.0')
self.check_develop(e, spack.spec.Spec('mpich@1.0')) self.check_develop(e, spack.spec.Spec('mpich@1.0'))
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_develop_no_clone(self, tmpdir): def test_develop_no_clone(self, tmpdir):
env('create', 'test') env('create', 'test')
with ev.read('test') as e: with ev.read('test') as e:
develop('--no-clone', '-p', str(tmpdir), 'mpich@1.0') develop('--no-clone', '-p', str(tmpdir), 'mpich@1.0')
self.check_develop(e, spack.spec.Spec('mpich@1.0'), str(tmpdir)) self.check_develop(e, spack.spec.Spec('mpich@1.0'), str(tmpdir))
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_develop(self): def test_develop(self):
env('create', 'test') env('create', 'test')
with ev.read('test') as e: with ev.read('test') as e:
develop('mpich@1.0') develop('mpich@1.0')
self.check_develop(e, spack.spec.Spec('mpich@1.0')) self.check_develop(e, spack.spec.Spec('mpich@1.0'))
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_develop_no_args(self): def test_develop_no_args(self):
env('create', 'test') env('create', 'test')
with ev.read('test') as e: with ev.read('test') as e:
@ -71,6 +76,7 @@ def test_develop_no_args(self):
develop() develop()
self.check_develop(e, spack.spec.Spec('mpich@1.0')) self.check_develop(e, spack.spec.Spec('mpich@1.0'))
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_develop_twice(self): def test_develop_twice(self):
env('create', 'test') env('create', 'test')
with ev.read('test') as e: with ev.read('test') as e:
@ -85,6 +91,7 @@ def test_develop_twice(self):
self.check_develop(e, spack.spec.Spec('mpich@1.0')) self.check_develop(e, spack.spec.Spec('mpich@1.0'))
assert len(e.dev_specs) == 1 assert len(e.dev_specs) == 1
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_develop_update_path(self, tmpdir): def test_develop_update_path(self, tmpdir):
env('create', 'test') env('create', 'test')
with ev.read('test') as e: with ev.read('test') as e:
@ -93,6 +100,7 @@ def test_develop_update_path(self, tmpdir):
self.check_develop(e, spack.spec.Spec('mpich@1.0'), str(tmpdir)) self.check_develop(e, spack.spec.Spec('mpich@1.0'), str(tmpdir))
assert len(e.dev_specs) == 1 assert len(e.dev_specs) == 1
@pytest.mark.skipif(sys.platform == 'win32', reason="not implemented on windows")
def test_develop_update_spec(self): def test_develop_update_spec(self):
env('create', 'test') env('create', 'test')
with ev.read('test') as e: with ev.read('test') as e:

View file

@ -3,6 +3,8 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest import pytest
import spack.cmd.diff import spack.cmd.diff
@ -43,6 +45,8 @@ def test_diff_cmd(install_mockery, mock_fetch, mock_archive, mock_packages):
assert ['hash', 'mpileaks %s' % specB.dag_hash()] in c['b_not_a'] assert ['hash', 'mpileaks %s' % specB.dag_hash()] in c['b_not_a']
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_load_first(install_mockery, mock_fetch, mock_archive, mock_packages): def test_load_first(install_mockery, mock_fetch, mock_archive, mock_packages):
"""Test with and without the --first option""" """Test with and without the --first option"""
install_cmd('mpileaks') install_cmd('mpileaks')

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import glob import glob
import os import os
import sys
from argparse import Namespace from argparse import Namespace
import pytest import pytest
@ -41,6 +42,11 @@
uninstall = SpackCommand('uninstall') uninstall = SpackCommand('uninstall')
find = SpackCommand('find') find = SpackCommand('find')
if sys.platform == 'win32':
sep = 'C:\\'
else:
sep = os.sep
def check_mpileaks_and_deps_in_view(viewdir): def check_mpileaks_and_deps_in_view(viewdir):
"""Check that the expected install directories exist.""" """Check that the expected install directories exist."""
@ -60,6 +66,8 @@ def test_add():
assert Spec('mpileaks') in e.user_specs assert Spec('mpileaks') in e.user_specs
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_env_add_virtual(): def test_env_add_virtual():
env('create', 'test') env('create', 'test')
@ -128,6 +136,8 @@ def test_env_remove(capfd):
assert 'bar' not in out assert 'bar' not in out
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_concretize(): def test_concretize():
e = ev.create('test') e = ev.create('test')
e.add('mpileaks') e.add('mpileaks')
@ -136,6 +146,8 @@ def test_concretize():
assert any(x.name == 'mpileaks' for x in env_specs) assert any(x.name == 'mpileaks' for x in env_specs)
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="InstallError:Wrong cmake was in environment")
def test_env_uninstalled_specs(install_mockery, mock_fetch): def test_env_uninstalled_specs(install_mockery, mock_fetch):
e = ev.create('test') e = ev.create('test')
e.add('cmake-client') e.add('cmake-client')
@ -149,6 +161,8 @@ def test_env_uninstalled_specs(install_mockery, mock_fetch):
assert any(s.name == 'mpileaks' for s in e.uninstalled_specs()) assert any(s.name == 'mpileaks' for s in e.uninstalled_specs())
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason='InstallError: Wrong cmake was in environment')
def test_env_install_all(install_mockery, mock_fetch): def test_env_install_all(install_mockery, mock_fetch):
e = ev.create('test') e = ev.create('test')
e.add('cmake-client') e.add('cmake-client')
@ -159,6 +173,8 @@ def test_env_install_all(install_mockery, mock_fetch):
assert spec.package.installed assert spec.package.installed
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason='InstallError: Wrong cmake was in environment')
def test_env_install_single_spec(install_mockery, mock_fetch): def test_env_install_single_spec(install_mockery, mock_fetch):
env('create', 'test') env('create', 'test')
install = SpackCommand('install') install = SpackCommand('install')
@ -173,6 +189,7 @@ def test_env_install_single_spec(install_mockery, mock_fetch):
assert e.specs_by_hash[e.concretized_order[0]].name == 'cmake-client' assert e.specs_by_hash[e.concretized_order[0]].name == 'cmake-client'
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_env_roots_marked_explicit(install_mockery, mock_fetch): def test_env_roots_marked_explicit(install_mockery, mock_fetch):
install = SpackCommand('install') install = SpackCommand('install')
install('dependent-install') install('dependent-install')
@ -194,6 +211,8 @@ def test_env_roots_marked_explicit(install_mockery, mock_fetch):
assert len(explicit) == 2 assert len(explicit) == 2
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason='InstallError: Wrong cmake was in environment')
def test_env_modifications_error_on_activate( def test_env_modifications_error_on_activate(
install_mockery, mock_fetch, monkeypatch, capfd): install_mockery, mock_fetch, monkeypatch, capfd):
env('create', 'test') env('create', 'test')
@ -216,6 +235,8 @@ def setup_error(pkg, env):
assert "Warning: couldn't get environment settings" in err assert "Warning: couldn't get environment settings" in err
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason='Error: filename or extension is too long')
def test_activate_adds_transitive_run_deps_to_path( def test_activate_adds_transitive_run_deps_to_path(
install_mockery, mock_fetch, monkeypatch): install_mockery, mock_fetch, monkeypatch):
env('create', 'test') env('create', 'test')
@ -230,6 +251,8 @@ def test_activate_adds_transitive_run_deps_to_path(
assert env_variables['DEPENDENCY_ENV_VAR'] == '1' assert env_variables['DEPENDENCY_ENV_VAR'] == '1'
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason='InstallError: Wrong cmake was in environment:')
def test_env_install_same_spec_twice(install_mockery, mock_fetch): def test_env_install_same_spec_twice(install_mockery, mock_fetch):
env('create', 'test') env('create', 'test')
@ -244,6 +267,8 @@ def test_env_install_same_spec_twice(install_mockery, mock_fetch):
assert 'already installed' in out assert 'already installed' in out
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_env_definition_symlink(install_mockery, mock_fetch, tmpdir): def test_env_definition_symlink(install_mockery, mock_fetch, tmpdir):
filepath = str(tmpdir.join('spack.yaml')) filepath = str(tmpdir.join('spack.yaml'))
filepath_mid = str(tmpdir.join('spack_mid.yaml')) filepath_mid = str(tmpdir.join('spack_mid.yaml'))
@ -263,6 +288,8 @@ def test_env_definition_symlink(install_mockery, mock_fetch, tmpdir):
assert os.path.islink(filepath_mid) assert os.path.islink(filepath_mid)
@pytest.mark.skipif(sys.platform == "win32",
reason='Logging error')
def test_env_install_two_specs_same_dep( def test_env_install_two_specs_same_dep(
install_mockery, mock_fetch, tmpdir, capsys): install_mockery, mock_fetch, tmpdir, capsys):
"""Test installation of two packages that share a dependency with no """Test installation of two packages that share a dependency with no
@ -298,6 +325,8 @@ def test_env_install_two_specs_same_dep(
assert a, 'Expected a to be installed' assert a, 'Expected a to be installed'
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_remove_after_concretize(): def test_remove_after_concretize():
e = ev.create('test') e = ev.create('test')
@ -321,6 +350,8 @@ def test_remove_after_concretize():
assert not any(s.name == 'mpileaks' for s in env_specs) assert not any(s.name == 'mpileaks' for s in env_specs)
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_remove_command(): def test_remove_command():
env('create', 'test') env('create', 'test')
assert 'test' in env('list') assert 'test' in env('list')
@ -384,6 +415,8 @@ def test_environment_status(capsys, tmpdir):
assert 'in current directory' in env('status') assert 'in current directory' in env('status')
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason='Not supported on Windows - uses pkgconf')
def test_env_status_broken_view( def test_env_status_broken_view(
mutable_mock_env_path, mock_archive, mock_fetch, mock_packages, mutable_mock_env_path, mock_archive, mock_fetch, mock_packages,
install_mockery, tmpdir install_mockery, tmpdir
@ -405,6 +438,8 @@ def test_env_status_broken_view(
assert 'includes out of date packages or repos' not in output assert 'includes out of date packages or repos' not in output
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason='Not supported on Windows - uses pkgconf')
def test_env_activate_broken_view( def test_env_activate_broken_view(
mutable_mock_env_path, mock_archive, mock_fetch, mock_packages, mutable_mock_env_path, mock_archive, mock_fetch, mock_packages,
install_mockery install_mockery
@ -423,6 +458,8 @@ def test_env_activate_broken_view(
env('activate', '--sh', 'test') env('activate', '--sh', 'test')
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_to_lockfile_dict(): def test_to_lockfile_dict():
e = ev.create('test') e = ev.create('test')
e.add('mpileaks') e.add('mpileaks')
@ -435,6 +472,8 @@ def test_to_lockfile_dict():
assert e.specs_by_hash == e_copy.specs_by_hash assert e.specs_by_hash == e_copy.specs_by_hash
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_env_repo(): def test_env_repo():
e = ev.create('test') e = ev.create('test')
e.add('mpileaks') e.add('mpileaks')
@ -448,6 +487,8 @@ def test_env_repo():
assert package.namespace == 'builtin.mock' assert package.namespace == 'builtin.mock'
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_user_removed_spec(): def test_user_removed_spec():
"""Ensure a user can remove from any position in the spack.yaml file.""" """Ensure a user can remove from any position in the spack.yaml file."""
initial_yaml = StringIO("""\ initial_yaml = StringIO("""\
@ -482,6 +523,8 @@ def test_user_removed_spec():
assert not any(x.name == 'hypre' for x in env_specs) assert not any(x.name == 'hypre' for x in env_specs)
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_init_from_lockfile(tmpdir): def test_init_from_lockfile(tmpdir):
"""Test that an environment can be instantiated from a lockfile.""" """Test that an environment can be instantiated from a lockfile."""
initial_yaml = StringIO("""\ initial_yaml = StringIO("""\
@ -508,6 +551,8 @@ def test_init_from_lockfile(tmpdir):
assert s1 == s2 assert s1 == s2
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_init_from_yaml(tmpdir): def test_init_from_yaml(tmpdir):
"""Test that an environment can be instantiated from a lockfile.""" """Test that an environment can be instantiated from a lockfile."""
initial_yaml = StringIO("""\ initial_yaml = StringIO("""\
@ -531,6 +576,8 @@ def test_init_from_yaml(tmpdir):
assert not e2.specs_by_hash assert not e2.specs_by_hash
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason='Not supported on Windows - uses pkgconf')
@pytest.mark.usefixtures('config') @pytest.mark.usefixtures('config')
def test_env_view_external_prefix( def test_env_view_external_prefix(
tmpdir_factory, mutable_database, mock_packages tmpdir_factory, mutable_database, mock_packages
@ -603,6 +650,8 @@ def test_init_with_file_and_remove(tmpdir):
assert 'test' not in out assert 'test' not in out
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_env_with_config(): def test_env_with_config():
test_config = """\ test_config = """\
env: env:
@ -622,6 +671,8 @@ def test_env_with_config():
for x in e._get_environment_specs()) for x in e._get_environment_specs())
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_with_config_bad_include(capfd): def test_with_config_bad_include(capfd):
env_name = 'test_bad_include' env_name = 'test_bad_include'
test_config = """\ test_config = """\
@ -641,10 +692,12 @@ def test_with_config_bad_include(capfd):
assert 'missing include' in err assert 'missing include' in err
assert '/no/such/directory' in err assert '/no/such/directory' in err
assert 'no/such/file.yaml' in err assert os.path.join('no', 'such', 'file.yaml') in err
assert ev.active_environment() is None assert ev.active_environment() is None
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_env_with_include_config_files_same_basename(): def test_env_with_include_config_files_same_basename():
test_config = """\ test_config = """\
env: env:
@ -687,6 +740,8 @@ def test_env_with_include_config_files_same_basename():
assert(environment_specs[1].satisfies('mpileaks@2.2')) assert(environment_specs[1].satisfies('mpileaks@2.2'))
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_env_with_included_config_file(): def test_env_with_included_config_file():
test_config = """\ test_config = """\
env: env:
@ -712,6 +767,8 @@ def test_env_with_included_config_file():
for x in e._get_environment_specs()) for x in e._get_environment_specs())
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_env_with_included_config_scope(): def test_env_with_included_config_scope():
config_scope_path = os.path.join(ev.root('test'), 'config') config_scope_path = os.path.join(ev.root('test'), 'config')
test_config = """\ test_config = """\
@ -741,6 +798,8 @@ def test_env_with_included_config_scope():
for x in e._get_environment_specs()) for x in e._get_environment_specs())
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_env_with_included_config_var_path(): def test_env_with_included_config_var_path():
config_var_path = os.path.join('$tempdir', 'included-config.yaml') config_var_path = os.path.join('$tempdir', 'included-config.yaml')
test_config = """\ test_config = """\
@ -770,6 +829,8 @@ def test_env_with_included_config_var_path():
for x in e._get_environment_specs()) for x in e._get_environment_specs())
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_env_config_precedence(): def test_env_config_precedence():
test_config = """\ test_config = """\
env: env:
@ -805,6 +866,8 @@ def test_env_config_precedence():
x.satisfies('libelf@0.8.12') for x in e._get_environment_specs()) x.satisfies('libelf@0.8.12') for x in e._get_environment_specs())
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_included_config_precedence(): def test_included_config_precedence():
test_config = """\ test_config = """\
env: env:
@ -859,6 +922,8 @@ def test_bad_env_yaml_format(tmpdir):
assert "'spacks' was unexpected" in str(e) assert "'spacks' was unexpected" in str(e)
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason='Not supported on Windows (yet)')
def test_env_loads(install_mockery, mock_fetch): def test_env_loads(install_mockery, mock_fetch):
env('create', 'test') env('create', 'test')
@ -880,6 +945,8 @@ def test_env_loads(install_mockery, mock_fetch):
assert 'module load mpileaks' in contents assert 'module load mpileaks' in contents
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_stage(mock_stage, mock_fetch, install_mockery): def test_stage(mock_stage, mock_fetch, install_mockery):
env('create', 'test') env('create', 'test')
@ -918,6 +985,8 @@ def test_env_commands_die_with_no_env_arg():
env('status') env('status')
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_env_blocks_uninstall(mock_stage, mock_fetch, install_mockery): def test_env_blocks_uninstall(mock_stage, mock_fetch, install_mockery):
env('create', 'test') env('create', 'test')
with ev.read('test'): with ev.read('test'):
@ -940,6 +1009,8 @@ def test_roots_display_with_variants():
assert "boost +shared" in out assert "boost +shared" in out
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_uninstall_removes_from_env(mock_stage, mock_fetch, install_mockery): def test_uninstall_removes_from_env(mock_stage, mock_fetch, install_mockery):
env('create', 'test') env('create', 'test')
with ev.read('test'): with ev.read('test'):
@ -982,6 +1053,8 @@ def create_v1_lockfile_dict(roots, all_specs):
return test_lockfile_dict return test_lockfile_dict
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows - uses pkgconf")
@pytest.mark.usefixtures('config') @pytest.mark.usefixtures('config')
def test_read_old_lock_and_write_new(tmpdir): def test_read_old_lock_and_write_new(tmpdir):
build_only = ('build',) build_only = ('build',)
@ -1013,11 +1086,14 @@ def test_read_old_lock_and_write_new(tmpdir):
y.build_hash()]) y.build_hash()])
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows - uses pkgconf")
@pytest.mark.usefixtures('config') @pytest.mark.usefixtures('config')
def test_read_old_lock_creates_backup(tmpdir): def test_read_old_lock_creates_backup(tmpdir):
"""When reading a version-1 lockfile, make sure that a backup of that file """When reading a version-1 lockfile, make sure that a backup of that file
is created. is created.
""" """
mock_repo = MockPackageMultiRepo() mock_repo = MockPackageMultiRepo()
y = mock_repo.add_package('y', [], []) y = mock_repo.add_package('y', [], [])
@ -1040,6 +1116,8 @@ def test_read_old_lock_creates_backup(tmpdir):
assert y.dag_hash() in lockfile_dict_v1['concrete_specs'] assert y.dag_hash() in lockfile_dict_v1['concrete_specs']
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows - uses pkgconf")
@pytest.mark.usefixtures('config') @pytest.mark.usefixtures('config')
def test_indirect_build_dep(): def test_indirect_build_dep():
"""Simple case of X->Y->Z where Y is a build/link dep and Z is a """Simple case of X->Y->Z where Y is a build/link dep and Z is a
@ -1075,6 +1153,8 @@ def noop(*args):
assert x_env_spec == x_concretized assert x_env_spec == x_concretized
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows - uses pkgconf")
@pytest.mark.usefixtures('config') @pytest.mark.usefixtures('config')
def test_store_different_build_deps(): def test_store_different_build_deps():
r"""Ensure that an environment can store two instances of a build-only r"""Ensure that an environment can store two instances of a build-only
@ -1128,6 +1208,8 @@ def noop(*args):
assert x_read['z'] != y_read['z'] assert x_read['z'] != y_read['z']
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason='Fails on windows')
def test_env_updates_view_install( def test_env_updates_view_install(
tmpdir, mock_stage, mock_fetch, install_mockery): tmpdir, mock_stage, mock_fetch, install_mockery):
view_dir = tmpdir.join('view') view_dir = tmpdir.join('view')
@ -1139,6 +1221,8 @@ def test_env_updates_view_install(
check_mpileaks_and_deps_in_view(view_dir) check_mpileaks_and_deps_in_view(view_dir)
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason='Fails on windows')
def test_env_view_fails( def test_env_view_fails(
tmpdir, mock_packages, mock_stage, mock_fetch, install_mockery): tmpdir, mock_packages, mock_stage, mock_fetch, install_mockery):
view_dir = tmpdir.join('view') view_dir = tmpdir.join('view')
@ -1151,6 +1235,8 @@ def test_env_view_fails(
install('--fake') install('--fake')
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason='Not supported on Windows (yet)')
def test_env_without_view_install( def test_env_without_view_install(
tmpdir, mock_stage, mock_fetch, install_mockery): tmpdir, mock_stage, mock_fetch, install_mockery):
# Test enabling a view after installing specs # Test enabling a view after installing specs
@ -1173,6 +1259,8 @@ def test_env_without_view_install(
check_mpileaks_and_deps_in_view(view_dir) check_mpileaks_and_deps_in_view(view_dir)
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_env_config_view_default( def test_env_config_view_default(
tmpdir, mock_stage, mock_fetch, install_mockery): tmpdir, mock_stage, mock_fetch, install_mockery):
# This config doesn't mention whether a view is enabled # This config doesn't mention whether a view is enabled
@ -1181,7 +1269,6 @@ def test_env_config_view_default(
specs: specs:
- mpileaks - mpileaks
""" """
_env_create('test', StringIO(test_config)) _env_create('test', StringIO(test_config))
with ev.read('test'): with ev.read('test'):
@ -1193,6 +1280,8 @@ def test_env_config_view_default(
assert view.get_spec('mpileaks') assert view.get_spec('mpileaks')
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason='Not supported on Windows (yet)')
def test_env_updates_view_install_package( def test_env_updates_view_install_package(
tmpdir, mock_stage, mock_fetch, install_mockery): tmpdir, mock_stage, mock_fetch, install_mockery):
view_dir = tmpdir.join('view') view_dir = tmpdir.join('view')
@ -1203,6 +1292,8 @@ def test_env_updates_view_install_package(
assert os.path.exists(str(view_dir.join('.spack/mpileaks'))) assert os.path.exists(str(view_dir.join('.spack/mpileaks')))
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason='Not supported on Windows (yet)')
def test_env_updates_view_add_concretize( def test_env_updates_view_add_concretize(
tmpdir, mock_stage, mock_fetch, install_mockery): tmpdir, mock_stage, mock_fetch, install_mockery):
view_dir = tmpdir.join('view') view_dir = tmpdir.join('view')
@ -1215,6 +1306,8 @@ def test_env_updates_view_add_concretize(
check_mpileaks_and_deps_in_view(view_dir) check_mpileaks_and_deps_in_view(view_dir)
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason='Not supported on Windows (yet)')
def test_env_updates_view_uninstall( def test_env_updates_view_uninstall(
tmpdir, mock_stage, mock_fetch, install_mockery): tmpdir, mock_stage, mock_fetch, install_mockery):
view_dir = tmpdir.join('view') view_dir = tmpdir.join('view')
@ -1230,6 +1323,8 @@ def test_env_updates_view_uninstall(
check_viewdir_removal(view_dir) check_viewdir_removal(view_dir)
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason='Not supported on Windows (yet)')
def test_env_updates_view_uninstall_referenced_elsewhere( def test_env_updates_view_uninstall_referenced_elsewhere(
tmpdir, mock_stage, mock_fetch, install_mockery): tmpdir, mock_stage, mock_fetch, install_mockery):
view_dir = tmpdir.join('view') view_dir = tmpdir.join('view')
@ -1247,6 +1342,8 @@ def test_env_updates_view_uninstall_referenced_elsewhere(
check_viewdir_removal(view_dir) check_viewdir_removal(view_dir)
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason='Not supported on Windows (yet)')
def test_env_updates_view_remove_concretize( def test_env_updates_view_remove_concretize(
tmpdir, mock_stage, mock_fetch, install_mockery): tmpdir, mock_stage, mock_fetch, install_mockery):
view_dir = tmpdir.join('view') view_dir = tmpdir.join('view')
@ -1265,6 +1362,8 @@ def test_env_updates_view_remove_concretize(
check_viewdir_removal(view_dir) check_viewdir_removal(view_dir)
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason='Not supported on Windows (yet)')
def test_env_updates_view_force_remove( def test_env_updates_view_force_remove(
tmpdir, mock_stage, mock_fetch, install_mockery): tmpdir, mock_stage, mock_fetch, install_mockery):
view_dir = tmpdir.join('view') view_dir = tmpdir.join('view')
@ -1280,6 +1379,8 @@ def test_env_updates_view_force_remove(
check_viewdir_removal(view_dir) check_viewdir_removal(view_dir)
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason='Not supported on Windows (yet)')
def test_env_activate_view_fails( def test_env_activate_view_fails(
tmpdir, mock_stage, mock_fetch, install_mockery): tmpdir, mock_stage, mock_fetch, install_mockery):
"""Sanity check on env activate to make sure it requires shell support""" """Sanity check on env activate to make sure it requires shell support"""
@ -1354,6 +1455,8 @@ def test_stack_yaml_definitions_as_constraints_on_matrix(tmpdir):
assert Spec('callpath^mpich@3.0.3') in test.user_specs assert Spec('callpath^mpich@3.0.3') in test.user_specs
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
@pytest.mark.regression('12095') @pytest.mark.regression('12095')
def test_stack_yaml_definitions_write_reference(tmpdir): def test_stack_yaml_definitions_write_reference(tmpdir):
filename = str(tmpdir.join('spack.yaml')) filename = str(tmpdir.join('spack.yaml'))
@ -1420,6 +1523,8 @@ def test_stack_yaml_remove_from_list(tmpdir):
assert Spec('callpath') in test.user_specs assert Spec('callpath') in test.user_specs
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_stack_yaml_remove_from_list_force(tmpdir): def test_stack_yaml_remove_from_list_force(tmpdir):
filename = str(tmpdir.join('spack.yaml')) filename = str(tmpdir.join('spack.yaml'))
with open(filename, 'w') as f: with open(filename, 'w') as f:
@ -1470,6 +1575,8 @@ def test_stack_yaml_remove_from_matrix_no_effect(tmpdir):
assert before == after assert before == after
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_stack_yaml_force_remove_from_matrix(tmpdir): def test_stack_yaml_force_remove_from_matrix(tmpdir):
filename = str(tmpdir.join('spack.yaml')) filename = str(tmpdir.join('spack.yaml'))
with open(filename, 'w') as f: with open(filename, 'w') as f:
@ -1503,6 +1610,8 @@ def test_stack_yaml_force_remove_from_matrix(tmpdir):
assert mpileaks_spec not in after_conc assert mpileaks_spec not in after_conc
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_stack_concretize_extraneous_deps(tmpdir, config, mock_packages): def test_stack_concretize_extraneous_deps(tmpdir, config, mock_packages):
# FIXME: The new concretizer doesn't handle yet soft # FIXME: The new concretizer doesn't handle yet soft
# FIXME: constraints for stacks # FIXME: constraints for stacks
@ -1538,6 +1647,8 @@ def test_stack_concretize_extraneous_deps(tmpdir, config, mock_packages):
assert concrete.satisfies('^mpi', strict=True) assert concrete.satisfies('^mpi', strict=True)
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_stack_concretize_extraneous_variants(tmpdir, config, mock_packages): def test_stack_concretize_extraneous_variants(tmpdir, config, mock_packages):
filename = str(tmpdir.join('spack.yaml')) filename = str(tmpdir.join('spack.yaml'))
with open(filename, 'w') as f: with open(filename, 'w') as f:
@ -1569,6 +1680,8 @@ def test_stack_concretize_extraneous_variants(tmpdir, config, mock_packages):
user.variants['shared'].value) user.variants['shared'].value)
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_stack_concretize_extraneous_variants_with_dash(tmpdir, config, def test_stack_concretize_extraneous_variants_with_dash(tmpdir, config,
mock_packages): mock_packages):
filename = str(tmpdir.join('spack.yaml')) filename = str(tmpdir.join('spack.yaml'))
@ -1617,6 +1730,8 @@ def test_stack_definition_extension(tmpdir):
assert Spec('callpath') in test.user_specs assert Spec('callpath') in test.user_specs
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_stack_definition_conditional_false(tmpdir): def test_stack_definition_conditional_false(tmpdir):
filename = str(tmpdir.join('spack.yaml')) filename = str(tmpdir.join('spack.yaml'))
with open(filename, 'w') as f: with open(filename, 'w') as f:
@ -1774,6 +1889,8 @@ def test_stack_definition_conditional_add_write(tmpdir):
assert 'zmpi' not in packages_lists[1]['packages'] assert 'zmpi' not in packages_lists[1]['packages']
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_stack_combinatorial_view(tmpdir, mock_fetch, mock_packages, def test_stack_combinatorial_view(tmpdir, mock_fetch, mock_packages,
mock_archive, install_mockery): mock_archive, install_mockery):
filename = str(tmpdir.join('spack.yaml')) filename = str(tmpdir.join('spack.yaml'))
@ -1806,6 +1923,8 @@ def test_stack_combinatorial_view(tmpdir, mock_fetch, mock_packages,
(spec.version, spec.compiler.name))) (spec.version, spec.compiler.name)))
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_stack_view_select(tmpdir, mock_fetch, mock_packages, def test_stack_view_select(tmpdir, mock_fetch, mock_packages,
mock_archive, install_mockery): mock_archive, install_mockery):
filename = str(tmpdir.join('spack.yaml')) filename = str(tmpdir.join('spack.yaml'))
@ -1844,6 +1963,8 @@ def test_stack_view_select(tmpdir, mock_fetch, mock_packages,
(spec.version, spec.compiler.name))) (spec.version, spec.compiler.name)))
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_stack_view_exclude(tmpdir, mock_fetch, mock_packages, def test_stack_view_exclude(tmpdir, mock_fetch, mock_packages,
mock_archive, install_mockery): mock_archive, install_mockery):
filename = str(tmpdir.join('spack.yaml')) filename = str(tmpdir.join('spack.yaml'))
@ -1882,6 +2003,8 @@ def test_stack_view_exclude(tmpdir, mock_fetch, mock_packages,
(spec.version, spec.compiler.name))) (spec.version, spec.compiler.name)))
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_stack_view_select_and_exclude(tmpdir, mock_fetch, mock_packages, def test_stack_view_select_and_exclude(tmpdir, mock_fetch, mock_packages,
mock_archive, install_mockery): mock_archive, install_mockery):
filename = str(tmpdir.join('spack.yaml')) filename = str(tmpdir.join('spack.yaml'))
@ -1921,6 +2044,8 @@ def test_stack_view_select_and_exclude(tmpdir, mock_fetch, mock_packages,
(spec.version, spec.compiler.name))) (spec.version, spec.compiler.name)))
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_view_link_roots(tmpdir, mock_fetch, mock_packages, mock_archive, def test_view_link_roots(tmpdir, mock_fetch, mock_packages, mock_archive,
install_mockery): install_mockery):
filename = str(tmpdir.join('spack.yaml')) filename = str(tmpdir.join('spack.yaml'))
@ -1962,6 +2087,8 @@ def test_view_link_roots(tmpdir, mock_fetch, mock_packages, mock_archive,
(spec.version, spec.compiler.name))) (spec.version, spec.compiler.name)))
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_view_link_run(tmpdir, mock_fetch, mock_packages, mock_archive, def test_view_link_run(tmpdir, mock_fetch, mock_packages, mock_archive,
install_mockery): install_mockery):
yaml = str(tmpdir.join('spack.yaml')) yaml = str(tmpdir.join('spack.yaml'))
@ -1993,6 +2120,8 @@ def test_view_link_run(tmpdir, mock_fetch, mock_packages, mock_archive,
assert not os.path.exists(os.path.join(viewdir, pkg)) assert not os.path.exists(os.path.join(viewdir, pkg))
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
@pytest.mark.parametrize('link_type', ['hardlink', 'copy', 'symlink']) @pytest.mark.parametrize('link_type', ['hardlink', 'copy', 'symlink'])
def test_view_link_type(link_type, tmpdir, mock_fetch, mock_packages, mock_archive, def test_view_link_type(link_type, tmpdir, mock_fetch, mock_packages, mock_archive,
install_mockery): install_mockery):
@ -2022,6 +2151,8 @@ def test_view_link_type(link_type, tmpdir, mock_fetch, mock_packages, mock_archi
assert os.path.islink(file_to_test) == (link_type == 'symlink') assert os.path.islink(file_to_test) == (link_type == 'symlink')
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_view_link_all(tmpdir, mock_fetch, mock_packages, mock_archive, def test_view_link_all(tmpdir, mock_fetch, mock_packages, mock_archive,
install_mockery): install_mockery):
filename = str(tmpdir.join('spack.yaml')) filename = str(tmpdir.join('spack.yaml'))
@ -2062,6 +2193,8 @@ def test_view_link_all(tmpdir, mock_fetch, mock_packages, mock_archive,
(spec.version, spec.compiler.name))) (spec.version, spec.compiler.name)))
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_stack_view_activate_from_default(tmpdir, mock_fetch, mock_packages, def test_stack_view_activate_from_default(tmpdir, mock_fetch, mock_packages,
mock_archive, install_mockery): mock_archive, install_mockery):
filename = str(tmpdir.join('spack.yaml')) filename = str(tmpdir.join('spack.yaml'))
@ -2093,6 +2226,8 @@ def test_stack_view_activate_from_default(tmpdir, mock_fetch, mock_packages,
assert 'FOOBAR=mpileaks' in shell assert 'FOOBAR=mpileaks' in shell
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_stack_view_no_activate_without_default(tmpdir, mock_fetch, def test_stack_view_no_activate_without_default(tmpdir, mock_fetch,
mock_packages, mock_archive, mock_packages, mock_archive,
install_mockery): install_mockery):
@ -2123,6 +2258,8 @@ def test_stack_view_no_activate_without_default(tmpdir, mock_fetch,
assert viewdir not in shell assert viewdir not in shell
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_stack_view_multiple_views(tmpdir, mock_fetch, mock_packages, def test_stack_view_multiple_views(tmpdir, mock_fetch, mock_packages,
mock_archive, install_mockery): mock_archive, install_mockery):
filename = str(tmpdir.join('spack.yaml')) filename = str(tmpdir.join('spack.yaml'))
@ -2225,6 +2362,8 @@ def test_env_activate_default_view_root_unconditional(mutable_mock_env_path):
'export PATH="{0}'.format(viewdir_bin) in out 'export PATH="{0}'.format(viewdir_bin) in out
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_concretize_user_specs_together(): def test_concretize_user_specs_together():
e = ev.create('coconcretization') e = ev.create('coconcretization')
e.concretization = 'together' e.concretization = 'together'
@ -2253,6 +2392,8 @@ def test_concretize_user_specs_together():
assert all('mpich' not in spec for _, spec in e.concretized_specs()) assert all('mpich' not in spec for _, spec in e.concretized_specs())
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_cant_install_single_spec_when_concretizing_together(): def test_cant_install_single_spec_when_concretizing_together():
e = ev.create('coconcretization') e = ev.create('coconcretization')
e.concretization = 'together' e.concretization = 'together'
@ -2262,6 +2403,8 @@ def test_cant_install_single_spec_when_concretizing_together():
e.install_all() e.install_all()
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_duplicate_packages_raise_when_concretizing_together(): def test_duplicate_packages_raise_when_concretizing_together():
e = ev.create('coconcretization') e = ev.create('coconcretization')
e.concretization = 'together' e.concretization = 'together'
@ -2274,6 +2417,8 @@ def test_duplicate_packages_raise_when_concretizing_together():
e.concretize() e.concretize()
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
def test_env_write_only_non_default(): def test_env_write_only_non_default():
env('create', 'test') env('create', 'test')
@ -2284,6 +2429,8 @@ def test_env_write_only_non_default():
assert yaml == ev.default_manifest_yaml assert yaml == ev.default_manifest_yaml
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
@pytest.mark.regression('20526') @pytest.mark.regression('20526')
def test_env_write_only_non_default_nested(tmpdir): def test_env_write_only_non_default_nested(tmpdir):
# setup an environment file # setup an environment file
@ -2318,6 +2465,8 @@ def test_env_write_only_non_default_nested(tmpdir):
assert manifest == contents assert manifest == contents
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
@pytest.fixture @pytest.fixture
def packages_yaml_v015(tmpdir): def packages_yaml_v015(tmpdir):
"""Return the path to an existing manifest in the v0.15.x format """Return the path to an existing manifest in the v0.15.x format
@ -2408,6 +2557,8 @@ def test_can_update_attributes_with_override(tmpdir):
env('update', '-y', str(abspath.dirname)) env('update', '-y', str(abspath.dirname))
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
@pytest.mark.regression('18338') @pytest.mark.regression('18338')
def test_newline_in_commented_sequence_is_not_an_issue(tmpdir): def test_newline_in_commented_sequence_is_not_an_issue(tmpdir):
spack_yaml = """ spack_yaml = """
@ -2443,6 +2594,8 @@ def extract_build_hash(environment):
assert libelf_first_hash == libelf_second_hash assert libelf_first_hash == libelf_second_hash
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason="Not supported on Windows (yet)")
@pytest.mark.regression('18441') @pytest.mark.regression('18441')
def test_lockfile_not_deleted_on_write_error(tmpdir, monkeypatch): def test_lockfile_not_deleted_on_write_error(tmpdir, monkeypatch):
raw_yaml = """ raw_yaml = """
@ -2516,7 +2669,8 @@ def test_rewrite_rel_dev_path_new_dir(tmpdir):
env('create', '-d', str(dest_env), str(spack_yaml)) env('create', '-d', str(dest_env), str(spack_yaml))
with ev.Environment(str(dest_env)) as e: with ev.Environment(str(dest_env)) as e:
assert e.dev_specs['mypkg1']['path'] == str(build_folder) assert e.dev_specs['mypkg1']['path'] == str(build_folder)
assert e.dev_specs['mypkg2']['path'] == '/some/other/path' assert e.dev_specs['mypkg2']['path'] == sep + os.path.join('some',
'other', 'path')
def test_rewrite_rel_dev_path_named_env(tmpdir): def test_rewrite_rel_dev_path_named_env(tmpdir):
@ -2526,7 +2680,8 @@ def test_rewrite_rel_dev_path_named_env(tmpdir):
env('create', 'named_env', str(spack_yaml)) env('create', 'named_env', str(spack_yaml))
with ev.read('named_env') as e: with ev.read('named_env') as e:
assert e.dev_specs['mypkg1']['path'] == str(build_folder) assert e.dev_specs['mypkg1']['path'] == str(build_folder)
assert e.dev_specs['mypkg2']['path'] == '/some/other/path' assert e.dev_specs['mypkg2']['path'] == sep + os.path.join('some',
'other', 'path')
def test_rewrite_rel_dev_path_original_dir(tmpdir): def test_rewrite_rel_dev_path_original_dir(tmpdir):
@ -2574,6 +2729,8 @@ def test_custom_version_concretize_together(tmpdir):
assert any('hdf5@myversion' in spec for _, spec in e.concretized_specs()) assert any('hdf5@myversion' in spec for _, spec in e.concretized_specs())
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_modules_relative_to_views(tmpdir, install_mockery, mock_fetch): def test_modules_relative_to_views(tmpdir, install_mockery, mock_fetch):
spack_yaml = """ spack_yaml = """
spack: spack:
@ -2605,6 +2762,8 @@ def test_modules_relative_to_views(tmpdir, install_mockery, mock_fetch):
assert spec.prefix not in contents assert spec.prefix not in contents
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_multiple_modules_post_env_hook(tmpdir, install_mockery, mock_fetch): def test_multiple_modules_post_env_hook(tmpdir, install_mockery, mock_fetch):
spack_yaml = """ spack_yaml = """
spack: spack:
@ -2707,10 +2866,14 @@ def test_custom_store_in_environment(mutable_config, tmpdir):
install_tree: install_tree:
root: /tmp/store root: /tmp/store
""") """)
if os.name == 'nt':
sep = '\\'
else:
sep = '/'
current_store_root = str(spack.store.root) current_store_root = str(spack.store.root)
assert str(current_store_root) != '/tmp/store' assert str(current_store_root) != sep + os.path.join('tmp', 'store')
with spack.environment.Environment(str(tmpdir)): with spack.environment.Environment(str(tmpdir)):
assert str(spack.store.root) == '/tmp/store' assert str(spack.store.root) == sep + os.path.join('tmp', 'store')
assert str(spack.store.root) == current_store_root assert str(spack.store.root) == current_store_root

View file

@ -3,6 +3,8 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest import pytest
from spack.main import SpackCommand, SpackCommandError from spack.main import SpackCommand, SpackCommandError
@ -25,6 +27,7 @@ def python_database(mock_packages, mutable_database):
yield yield
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.db @pytest.mark.db
def test_extensions(mock_packages, python_database, config, capsys): def test_extensions(mock_packages, python_database, config, capsys):
ext2 = Spec("py-extension2").concretized() ext2 = Spec("py-extension2").concretized()

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os import os
import os.path import os.path
import sys
import pytest import pytest
@ -24,6 +25,7 @@ def _mock_search(path_hints=None):
return _factory return _factory
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_find_external_single_package(mock_executable, executables_found): def test_find_external_single_package(mock_executable, executables_found):
pkgs_to_check = [spack.repo.get('cmake')] pkgs_to_check = [spack.repo.get('cmake')]
executables_found({ executables_found({
@ -38,6 +40,7 @@ def test_find_external_single_package(mock_executable, executables_found):
assert single_entry.spec == Spec('cmake@1.foo') assert single_entry.spec == Spec('cmake@1.foo')
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_find_external_two_instances_same_package(mock_executable, executables_found): def test_find_external_two_instances_same_package(mock_executable, executables_found):
pkgs_to_check = [spack.repo.get('cmake')] pkgs_to_check = [spack.repo.get('cmake')]
@ -92,6 +95,7 @@ def test_get_executables(working_env, mock_executable):
external = SpackCommand('external') external = SpackCommand('external')
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_find_external_cmd(mutable_config, working_env, mock_executable): def test_find_external_cmd(mutable_config, working_env, mock_executable):
"""Test invoking 'spack external find' with additional package arguments, """Test invoking 'spack external find' with additional package arguments,
which restricts the set of packages that Spack looks for. which restricts the set of packages that Spack looks for.
@ -109,6 +113,7 @@ def test_find_external_cmd(mutable_config, working_env, mock_executable):
assert {'spec': 'cmake@1.foo', 'prefix': prefix} in cmake_externals assert {'spec': 'cmake@1.foo', 'prefix': prefix} in cmake_externals
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_find_external_cmd_not_buildable( def test_find_external_cmd_not_buildable(
mutable_config, working_env, mock_executable): mutable_config, working_env, mock_executable):
"""When the user invokes 'spack external find --not-buildable', the config """When the user invokes 'spack external find --not-buildable', the config
@ -122,6 +127,7 @@ def test_find_external_cmd_not_buildable(
assert not pkgs_cfg['cmake']['buildable'] assert not pkgs_cfg['cmake']['buildable']
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_find_external_cmd_full_repo( def test_find_external_cmd_full_repo(
mutable_config, working_env, mock_executable, mutable_mock_repo): mutable_config, working_env, mock_executable, mutable_mock_repo):
"""Test invoking 'spack external find --all' with no additional arguments """Test invoking 'spack external find --all' with no additional arguments
@ -180,11 +186,13 @@ def test_find_external_merge(mutable_config, mutable_mock_repo):
'prefix': '/x/y2/'} in pkg_externals 'prefix': '/x/y2/'} in pkg_externals
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_list_detectable_packages(mutable_config, mutable_mock_repo): def test_list_detectable_packages(mutable_config, mutable_mock_repo):
external("list") external("list")
assert external.returncode == 0 assert external.returncode == 0
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_packages_yaml_format(mock_executable, mutable_config, monkeypatch): def test_packages_yaml_format(mock_executable, mutable_config, monkeypatch):
# Prepare an environment to detect a fake gcc # Prepare an environment to detect a fake gcc
gcc_exe = mock_executable('gcc', output="echo 4.2.1") gcc_exe = mock_executable('gcc', output="echo 4.2.1")
@ -209,6 +217,7 @@ def test_packages_yaml_format(mock_executable, mutable_config, monkeypatch):
assert extra_attributes['compilers']['c'] == gcc_exe assert extra_attributes['compilers']['c'] == gcc_exe
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_overriding_prefix(mock_executable, mutable_config, monkeypatch): def test_overriding_prefix(mock_executable, mutable_config, monkeypatch):
# Prepare an environment to detect a fake gcc that # Prepare an environment to detect a fake gcc that
# override its external prefix # override its external prefix
@ -238,6 +247,7 @@ def _determine_variants(cls, exes, version_str):
assert externals[0]['prefix'] == '/opt/gcc/bin' assert externals[0]['prefix'] == '/opt/gcc/bin'
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_new_entries_are_reported_correctly( def test_new_entries_are_reported_correctly(
mock_executable, mutable_config, monkeypatch mock_executable, mutable_config, monkeypatch
): ):
@ -256,6 +266,7 @@ def test_new_entries_are_reported_correctly(
assert 'No new external packages detected' in output assert 'No new external packages detected' in output
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.parametrize('command_args', [ @pytest.mark.parametrize('command_args', [
('-t', 'build-tools'), ('-t', 'build-tools'),
('-t', 'build-tools', 'cmake'), ('-t', 'build-tools', 'cmake'),

View file

@ -3,6 +3,8 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest import pytest
import spack.environment as ev import spack.environment as ev
@ -14,6 +16,7 @@
) )
@pytest.mark.skipif(sys.platform == 'win32', reason="Hangs on windows")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_fetch_in_env( def test_fetch_in_env(
tmpdir, mock_archive, mock_stage, mock_fetch, install_mockery tmpdir, mock_archive, mock_stage, mock_fetch, install_mockery
@ -27,6 +30,7 @@ def test_fetch_in_env(
SpackCommand("fetch")() SpackCommand("fetch")()
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_fetch_single_spec( def test_fetch_single_spec(
tmpdir, mock_archive, mock_stage, mock_fetch, install_mockery tmpdir, mock_archive, mock_stage, mock_fetch, install_mockery
@ -34,6 +38,7 @@ def test_fetch_single_spec(
SpackCommand("fetch")("mpileaks") SpackCommand("fetch")("mpileaks")
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_fetch_multiple_specs( def test_fetch_multiple_specs(
tmpdir, mock_archive, mock_stage, mock_fetch, install_mockery tmpdir, mock_archive, mock_stage, mock_fetch, install_mockery

View file

@ -6,6 +6,7 @@
import argparse import argparse
import json import json
import os import os
import sys
import pytest import pytest
@ -48,6 +49,7 @@ def display(x, *args, **kwargs):
monkeypatch.setattr(spack.cmd, 'display_specs', display) monkeypatch.setattr(spack.cmd, 'display_specs', display)
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_query_arguments(): def test_query_arguments():
query_arguments = spack.cmd.find.query_arguments query_arguments = spack.cmd.find.query_arguments
@ -85,6 +87,7 @@ def test_query_arguments():
assert q_args['explicit'] is False assert q_args['explicit'] is False
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.db @pytest.mark.db
@pytest.mark.usefixtures('database', 'mock_display') @pytest.mark.usefixtures('database', 'mock_display')
def test_tag1(parser, specs): def test_tag1(parser, specs):
@ -97,6 +100,7 @@ def test_tag1(parser, specs):
assert 'mpich2' in [x.name for x in specs] assert 'mpich2' in [x.name for x in specs]
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.db @pytest.mark.db
@pytest.mark.usefixtures('database', 'mock_display') @pytest.mark.usefixtures('database', 'mock_display')
def test_tag2(parser, specs): def test_tag2(parser, specs):
@ -107,6 +111,7 @@ def test_tag2(parser, specs):
assert 'mpich' in [x.name for x in specs] assert 'mpich' in [x.name for x in specs]
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.db @pytest.mark.db
@pytest.mark.usefixtures('database', 'mock_display') @pytest.mark.usefixtures('database', 'mock_display')
def test_tag2_tag3(parser, specs): def test_tag2_tag3(parser, specs):
@ -116,6 +121,7 @@ def test_tag2_tag3(parser, specs):
assert len(specs) == 0 assert len(specs) == 0
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.db @pytest.mark.db
def test_namespaces_shown_correctly(database): def test_namespaces_shown_correctly(database):
out = find() out = find()
@ -151,6 +157,7 @@ def _check_json_output_deps(spec_list):
assert names.count("libelf") == 1 assert names.count("libelf") == 1
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.db @pytest.mark.db
def test_find_json(database): def test_find_json(database):
output = find('--json', 'mpileaks') output = find('--json', 'mpileaks')
@ -158,6 +165,7 @@ def test_find_json(database):
_check_json_output(spec_list) _check_json_output(spec_list)
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.db @pytest.mark.db
def test_find_json_deps(database): def test_find_json_deps(database):
output = find('-d', '--json', 'mpileaks') output = find('-d', '--json', 'mpileaks')
@ -165,6 +173,7 @@ def test_find_json_deps(database):
_check_json_output_deps(spec_list) _check_json_output_deps(spec_list)
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.db @pytest.mark.db
def test_display_json(database, capsys): def test_display_json(database, capsys):
specs = [Spec(s).concretized() for s in [ specs = [Spec(s).concretized() for s in [
@ -182,6 +191,7 @@ def test_display_json(database, capsys):
_check_json_output(spec_list) _check_json_output(spec_list)
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.db @pytest.mark.db
def test_display_json_deps(database, capsys): def test_display_json_deps(database, capsys):
specs = [Spec(s).concretized() for s in [ specs = [Spec(s).concretized() for s in [
@ -199,6 +209,7 @@ def test_display_json_deps(database, capsys):
_check_json_output_deps(spec_list) _check_json_output_deps(spec_list)
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.db @pytest.mark.db
def test_find_format(database, config): def test_find_format(database, config):
output = find('--format', '{name}-{^mpi.name}', 'mpileaks') output = find('--format', '{name}-{^mpi.name}', 'mpileaks')
@ -232,6 +243,7 @@ def test_find_format(database, config):
assert c in base32_alphabet assert c in base32_alphabet
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.db @pytest.mark.db
def test_find_format_deps(database, config): def test_find_format_deps(database, config):
output = find('-d', '--format', '{name}-{version}', 'mpileaks', '^zmpi') output = find('-d', '--format', '{name}-{version}', 'mpileaks', '^zmpi')
@ -247,6 +259,7 @@ def test_find_format_deps(database, config):
""" """
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.db @pytest.mark.db
def test_find_format_deps_paths(database, config): def test_find_format_deps_paths(database, config):
output = find('-dp', '--format', '{name}-{version}', 'mpileaks', '^zmpi') output = find('-dp', '--format', '{name}-{version}', 'mpileaks', '^zmpi')
@ -266,6 +279,7 @@ def test_find_format_deps_paths(database, config):
""".format(*prefixes) """.format(*prefixes)
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.db @pytest.mark.db
def test_find_very_long(database, config): def test_find_very_long(database, config):
output = find('-L', '--no-groups', "mpileaks") output = find('-L', '--no-groups', "mpileaks")
@ -281,12 +295,14 @@ def test_find_very_long(database, config):
]) ])
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.db @pytest.mark.db
def test_find_show_compiler(database, config): def test_find_show_compiler(database, config):
output = find('--no-groups', '--show-full-compiler', "mpileaks") output = find('--no-groups', '--show-full-compiler', "mpileaks")
assert "mpileaks@2.3%gcc@4.5.0" in output assert "mpileaks@2.3%gcc@4.5.0" in output
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.db @pytest.mark.db
def test_find_not_found(database, config, capsys): def test_find_not_found(database, config, capsys):
with capsys.disabled(): with capsys.disabled():
@ -295,6 +311,7 @@ def test_find_not_found(database, config, capsys):
assert find.returncode == 1 assert find.returncode == 1
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.db @pytest.mark.db
def test_find_no_sections(database, config): def test_find_no_sections(database, config):
output = find() output = find()
@ -305,12 +322,14 @@ def test_find_no_sections(database, config):
assert "==>" not in output assert "==>" not in output
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.db @pytest.mark.db
def test_find_command_basic_usage(database): def test_find_command_basic_usage(database):
output = find() output = find()
assert 'mpileaks' in output assert 'mpileaks' in output
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.regression('9875') @pytest.mark.regression('9875')
def test_find_prefix_in_env(mutable_mock_env_path, install_mockery, mock_fetch, def test_find_prefix_in_env(mutable_mock_env_path, install_mockery, mock_fetch,
mock_packages, mock_archive, config): mock_packages, mock_archive, config):
@ -324,6 +343,7 @@ def test_find_prefix_in_env(mutable_mock_env_path, install_mockery, mock_fetch,
# Would throw error on regression # Would throw error on regression
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_find_loaded(database, working_env): def test_find_loaded(database, working_env):
output = find('--loaded', '--group') output = find('--loaded', '--group')
assert output == '' assert output == ''

View file

@ -3,6 +3,8 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest import pytest
import spack.environment as ev import spack.environment as ev
@ -12,6 +14,7 @@
gc = spack.main.SpackCommand('gc') gc = spack.main.SpackCommand('gc')
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
@pytest.mark.db @pytest.mark.db
def test_no_packages_to_remove(config, mutable_database, capsys): def test_no_packages_to_remove(config, mutable_database, capsys):
with capsys.disabled(): with capsys.disabled():
@ -19,6 +22,7 @@ def test_no_packages_to_remove(config, mutable_database, capsys):
assert 'There are no unused specs.' in output assert 'There are no unused specs.' in output
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
@pytest.mark.db @pytest.mark.db
def test_packages_are_removed(config, mutable_database, capsys): def test_packages_are_removed(config, mutable_database, capsys):
s = spack.spec.Spec('simple-inheritance') s = spack.spec.Spec('simple-inheritance')
@ -29,6 +33,7 @@ def test_packages_are_removed(config, mutable_database, capsys):
assert 'Successfully uninstalled cmake' in output assert 'Successfully uninstalled cmake' in output
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
@pytest.mark.db @pytest.mark.db
def test_gc_with_environment( def test_gc_with_environment(
config, mutable_database, mutable_mock_env_path, capsys config, mutable_database, mutable_mock_env_path, capsys

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os import os
import sys
import pytest import pytest
@ -21,6 +22,7 @@
bootstrap = SpackCommand('bootstrap') bootstrap = SpackCommand('bootstrap')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
# test gpg command detection # test gpg command detection
@pytest.mark.parametrize('cmd_name,version', [ @pytest.mark.parametrize('cmd_name,version', [
('gpg', 'undetectable'), # undetectable version ('gpg', 'undetectable'), # undetectable version
@ -55,6 +57,7 @@ def test_no_gpg_in_path(tmpdir, mock_gnupghome, monkeypatch, mutable_config):
spack.util.gpg.init(force=True) spack.util.gpg.init(force=True)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.maybeslow @pytest.mark.maybeslow
def test_gpg(tmpdir, mock_gnupghome): def test_gpg(tmpdir, mock_gnupghome):
# Verify a file with an empty keyring. # Verify a file with an empty keyring.

View file

@ -3,6 +3,8 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest import pytest
from spack.main import SpackCommand, SpackCommandError from spack.main import SpackCommand, SpackCommandError
@ -10,6 +12,7 @@
graph = SpackCommand('graph') graph = SpackCommand('graph')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
@pytest.mark.usefixtures('mock_packages', 'database') @pytest.mark.usefixtures('mock_packages', 'database')
def test_graph_ascii(): def test_graph_ascii():
@ -17,6 +20,7 @@ def test_graph_ascii():
graph('--ascii', 'dt-diamond') graph('--ascii', 'dt-diamond')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
@pytest.mark.usefixtures('mock_packages', 'database') @pytest.mark.usefixtures('mock_packages', 'database')
def test_graph_dot(): def test_graph_dot():
@ -24,6 +28,7 @@ def test_graph_dot():
graph('--dot', 'dt-diamond') graph('--dot', 'dt-diamond')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
@pytest.mark.usefixtures('mock_packages', 'database') @pytest.mark.usefixtures('mock_packages', 'database')
def test_graph_static(): def test_graph_static():
@ -31,6 +36,7 @@ def test_graph_static():
graph('--static', 'dt-diamond') graph('--static', 'dt-diamond')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
@pytest.mark.usefixtures('mock_packages', 'database') @pytest.mark.usefixtures('mock_packages', 'database')
def test_graph_installed(): def test_graph_installed():
@ -42,6 +48,7 @@ def test_graph_installed():
graph('--installed', 'dt-diamond') graph('--installed', 'dt-diamond')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
@pytest.mark.usefixtures('mock_packages', 'database') @pytest.mark.usefixtures('mock_packages', 'database')
def test_graph_deptype(): def test_graph_deptype():
@ -49,6 +56,7 @@ def test_graph_deptype():
graph('--deptype', 'all', 'dt-diamond') graph('--deptype', 'all', 'dt-diamond')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_graph_no_specs(): def test_graph_no_specs():
"""Tests spack graph with no arguments""" """Tests spack graph with no arguments"""

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import argparse import argparse
import sys
import pytest import pytest
@ -36,6 +37,7 @@ def _print(*args):
monkeypatch.setattr(spack.cmd.info.color, 'cprint', _print, raising=False) monkeypatch.setattr(spack.cmd.info.color, 'cprint', _print, raising=False)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.parametrize('pkg', [ @pytest.mark.parametrize('pkg', [
'openmpi', 'openmpi',
'trilinos', 'trilinos',
@ -48,6 +50,7 @@ def test_it_just_runs(pkg):
info(pkg) info(pkg)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_info_noversion(mock_packages, info_lines, mock_print): def test_info_noversion(mock_packages, info_lines, mock_print):
"""Check that a mock package with no versions or variants outputs None.""" """Check that a mock package with no versions or variants outputs None."""
info('noversion') info('noversion')
@ -80,6 +83,7 @@ def test_is_externally_detectable(pkg_query, expected, parser, info_lines):
assert is_externally_detectable == expected assert is_externally_detectable == expected
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.parametrize('pkg_query', [ @pytest.mark.parametrize('pkg_query', [
'hdf5', 'hdf5',
'cloverleaf3d', 'cloverleaf3d',

View file

@ -8,6 +8,7 @@
import os import os
import re import re
import shutil import shutil
import sys
import time import time
import pytest import pytest
@ -42,6 +43,7 @@ def noop(*args, **kwargs):
monkeypatch.setattr(spack.installer.PackageInstaller, 'install', noop) monkeypatch.setattr(spack.installer.PackageInstaller, 'install', noop)
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_install_package_and_dependency( def test_install_package_and_dependency(
tmpdir, mock_packages, mock_archive, mock_fetch, config, tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery): install_mockery):
@ -59,6 +61,7 @@ def test_install_package_and_dependency(
assert 'errors="0"' in content assert 'errors="0"' in content
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_install_runtests_notests(monkeypatch, mock_packages, install_mockery): def test_install_runtests_notests(monkeypatch, mock_packages, install_mockery):
def check(pkg): def check(pkg):
@ -67,6 +70,7 @@ def check(pkg):
install('-v', 'dttop') install('-v', 'dttop')
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_install_runtests_root(monkeypatch, mock_packages, install_mockery): def test_install_runtests_root(monkeypatch, mock_packages, install_mockery):
def check(pkg): def check(pkg):
@ -76,6 +80,7 @@ def check(pkg):
install('--test=root', 'dttop') install('--test=root', 'dttop')
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_install_runtests_all(monkeypatch, mock_packages, install_mockery): def test_install_runtests_all(monkeypatch, mock_packages, install_mockery):
def check(pkg): def check(pkg):
@ -86,6 +91,7 @@ def check(pkg):
install('--run-tests', 'a') install('--run-tests', 'a')
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_install_package_already_installed( def test_install_package_already_installed(
tmpdir, mock_packages, mock_archive, mock_fetch, config, tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery): install_mockery):
@ -107,6 +113,7 @@ def test_install_package_already_installed(
assert len(skipped) == 2 assert len(skipped) == 2
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.parametrize('arguments,expected', [ @pytest.mark.parametrize('arguments,expected', [
([], spack.config.get('config:dirty')), # default from config file ([], spack.config.get('config:dirty')), # default from config file
(['--clean'], False), (['--clean'], False),
@ -119,6 +126,7 @@ def test_install_dirty_flag(arguments, expected):
assert args.dirty == expected assert args.dirty == expected
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_package_output(tmpdir, capsys, install_mockery, mock_fetch): def test_package_output(tmpdir, capsys, install_mockery, mock_fetch):
""" """
Ensure output printed from pkgs is captured by output redirection. Ensure output printed from pkgs is captured by output redirection.
@ -140,6 +148,7 @@ def test_package_output(tmpdir, capsys, install_mockery, mock_fetch):
assert "AFTER INSTALL" in out assert "AFTER INSTALL" in out
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_install_output_on_build_error(mock_packages, mock_archive, mock_fetch, def test_install_output_on_build_error(mock_packages, mock_archive, mock_fetch,
config, install_mockery, capfd): config, install_mockery, capfd):
@ -154,6 +163,7 @@ def test_install_output_on_build_error(mock_packages, mock_archive, mock_fetch,
assert 'Installing build-error' in out assert 'Installing build-error' in out
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_install_output_on_python_error( def test_install_output_on_python_error(
mock_packages, mock_archive, mock_fetch, config, install_mockery): mock_packages, mock_archive, mock_fetch, config, install_mockery):
@ -163,6 +173,7 @@ def test_install_output_on_python_error(
assert 'raise InstallError("Expected failure.")' in out assert 'raise InstallError("Expected failure.")' in out
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_install_with_source( def test_install_with_source(
mock_packages, mock_archive, mock_fetch, config, install_mockery): mock_packages, mock_archive, mock_fetch, config, install_mockery):
@ -175,6 +186,7 @@ def test_install_with_source(
os.path.join(src, 'configure')) os.path.join(src, 'configure'))
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_install_env_variables( def test_install_env_variables(
mock_packages, mock_archive, mock_fetch, config, install_mockery mock_packages, mock_archive, mock_fetch, config, install_mockery
): ):
@ -184,6 +196,7 @@ def test_install_env_variables(
assert os.path.isfile(spec.package.install_env_path) assert os.path.isfile(spec.package.install_env_path)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_show_log_on_error(mock_packages, mock_archive, mock_fetch, def test_show_log_on_error(mock_packages, mock_archive, mock_fetch,
config, install_mockery, capfd): config, install_mockery, capfd):
@ -200,6 +213,7 @@ def test_show_log_on_error(mock_packages, mock_archive, mock_fetch,
assert 'See build log for details:' in out assert 'See build log for details:' in out
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_install_overwrite( def test_install_overwrite(
mock_packages, mock_archive, mock_fetch, config, install_mockery mock_packages, mock_archive, mock_fetch, config, install_mockery
): ):
@ -233,6 +247,7 @@ def test_install_overwrite(
assert fs.hash_directory(spec.prefix, ignore=ignores) != bad_md5 assert fs.hash_directory(spec.prefix, ignore=ignores) != bad_md5
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_install_overwrite_not_installed( def test_install_overwrite_not_installed(
mock_packages, mock_archive, mock_fetch, config, install_mockery, mock_packages, mock_archive, mock_fetch, config, install_mockery,
): ):
@ -246,6 +261,7 @@ def test_install_overwrite_not_installed(
assert os.path.exists(spec.prefix) assert os.path.exists(spec.prefix)
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_install_commit( def test_install_commit(
mock_git_version_info, install_mockery, mock_packages, monkeypatch): mock_git_version_info, install_mockery, mock_packages, monkeypatch):
"""Test installing a git package from a commit. """Test installing a git package from a commit.
@ -273,6 +289,7 @@ def test_install_commit(
assert content == '[]' # contents are weird for another test assert content == '[]' # contents are weird for another test
@pytest.mark.skipif(sys.platform == 'win32', reason="Not yet implemented on windows")
def test_install_overwrite_multiple( def test_install_overwrite_multiple(
mock_packages, mock_archive, mock_fetch, config, install_mockery mock_packages, mock_archive, mock_fetch, config, install_mockery
): ):
@ -330,6 +347,7 @@ def test_install_overwrite_multiple(
assert cm_hash != bad_cmake_md5 assert cm_hash != bad_cmake_md5
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.usefixtures( @pytest.mark.usefixtures(
'mock_packages', 'mock_archive', 'mock_fetch', 'config', 'install_mockery', 'mock_packages', 'mock_archive', 'mock_fetch', 'config', 'install_mockery',
) )
@ -339,6 +357,7 @@ def test_install_conflicts(conflict_spec):
install(conflict_spec) install(conflict_spec)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.usefixtures( @pytest.mark.usefixtures(
'mock_packages', 'mock_archive', 'mock_fetch', 'config', 'install_mockery', 'mock_packages', 'mock_archive', 'mock_fetch', 'config', 'install_mockery',
) )
@ -348,6 +367,7 @@ def test_install_invalid_spec(invalid_spec):
install(invalid_spec) install(invalid_spec)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.usefixtures('noop_install', 'mock_packages', 'config') @pytest.mark.usefixtures('noop_install', 'mock_packages', 'config')
@pytest.mark.parametrize('spec,concretize,error_code', [ @pytest.mark.parametrize('spec,concretize,error_code', [
(Spec('mpi'), False, 1), (Spec('mpi'), False, 1),
@ -380,6 +400,7 @@ def test_install_from_file(spec, concretize, error_code, tmpdir):
assert err_msg in out assert err_msg in out
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
@pytest.mark.usefixtures( @pytest.mark.usefixtures(
'mock_packages', 'mock_archive', 'mock_fetch', 'config', 'install_mockery' 'mock_packages', 'mock_archive', 'mock_fetch', 'config', 'install_mockery'
@ -422,6 +443,7 @@ def test_junit_output_with_failures(tmpdir, exc_typename, msg):
assert msg in content assert msg in content
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
@pytest.mark.parametrize('exc_typename,expected_exc,msg', [ @pytest.mark.parametrize('exc_typename,expected_exc,msg', [
('RuntimeError', spack.installer.InstallError, 'something weird happened'), ('RuntimeError', spack.installer.InstallError, 'something weird happened'),
@ -465,6 +487,7 @@ def just_throw(*args, **kwargs):
assert 'error message="{0}"'.format(msg) in content assert 'error message="{0}"'.format(msg) in content
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.usefixtures('noop_install', 'mock_packages', 'config') @pytest.mark.usefixtures('noop_install', 'mock_packages', 'config')
@pytest.mark.parametrize('clispecs,filespecs', [ @pytest.mark.parametrize('clispecs,filespecs', [
[[], ['mpi']], [[], ['mpi']],
@ -489,6 +512,7 @@ def test_install_mix_cli_and_files(clispecs, filespecs, tmpdir):
assert install.returncode == 0 assert install.returncode == 0
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_extra_files_are_archived(mock_packages, mock_archive, mock_fetch, def test_extra_files_are_archived(mock_packages, mock_archive, mock_fetch,
config, install_mockery): config, install_mockery):
s = Spec('archive-files') s = Spec('archive-files')
@ -508,6 +532,7 @@ def test_extra_files_are_archived(mock_packages, mock_archive, mock_fetch,
assert os.path.exists(errors_txt) assert os.path.exists(errors_txt)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_cdash_report_concretization_error(tmpdir, mock_fetch, install_mockery, def test_cdash_report_concretization_error(tmpdir, mock_fetch, install_mockery,
capfd, conflict_spec): capfd, conflict_spec):
@ -534,6 +559,7 @@ def test_cdash_report_concretization_error(tmpdir, mock_fetch, install_mockery,
assert any(x in content for x in expected_messages) assert any(x in content for x in expected_messages)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_cdash_upload_build_error(tmpdir, mock_fetch, install_mockery, def test_cdash_upload_build_error(tmpdir, mock_fetch, install_mockery,
capfd): capfd):
@ -554,6 +580,7 @@ def test_cdash_upload_build_error(tmpdir, mock_fetch, install_mockery,
assert '<Text>configure: error: in /path/to/some/file:</Text>' in content assert '<Text>configure: error: in /path/to/some/file:</Text>' in content
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_cdash_upload_clean_build(tmpdir, mock_fetch, install_mockery, capfd): def test_cdash_upload_clean_build(tmpdir, mock_fetch, install_mockery, capfd):
# capfd interferes with Spack's capturing of e.g., Build.xml output # capfd interferes with Spack's capturing of e.g., Build.xml output
@ -572,6 +599,7 @@ def test_cdash_upload_clean_build(tmpdir, mock_fetch, install_mockery, capfd):
assert '<Text>' not in content assert '<Text>' not in content
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_cdash_upload_extra_params(tmpdir, mock_fetch, install_mockery, capfd): def test_cdash_upload_extra_params(tmpdir, mock_fetch, install_mockery, capfd):
# capfd interferes with Spack's capture of e.g., Build.xml output # capfd interferes with Spack's capture of e.g., Build.xml output
@ -594,6 +622,7 @@ def test_cdash_upload_extra_params(tmpdir, mock_fetch, install_mockery, capfd):
assert '-my_custom_track' in content assert '-my_custom_track' in content
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_cdash_buildstamp_param(tmpdir, mock_fetch, install_mockery, capfd): def test_cdash_buildstamp_param(tmpdir, mock_fetch, install_mockery, capfd):
# capfd interferes with Spack's capture of e.g., Build.xml output # capfd interferes with Spack's capture of e.g., Build.xml output
@ -616,6 +645,7 @@ def test_cdash_buildstamp_param(tmpdir, mock_fetch, install_mockery, capfd):
assert buildstamp in content assert buildstamp in content
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_cdash_install_from_spec_yaml(tmpdir, mock_fetch, install_mockery, def test_cdash_install_from_spec_yaml(tmpdir, mock_fetch, install_mockery,
capfd, mock_packages, mock_archive, capfd, mock_packages, mock_archive,
@ -654,6 +684,7 @@ def test_cdash_install_from_spec_yaml(tmpdir, mock_fetch, install_mockery,
assert 'a@' in install_command assert 'a@' in install_command
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_build_error_output(tmpdir, mock_fetch, install_mockery, capfd): def test_build_error_output(tmpdir, mock_fetch, install_mockery, capfd):
with capfd.disabled(): with capfd.disabled():
@ -668,6 +699,7 @@ def test_build_error_output(tmpdir, mock_fetch, install_mockery, capfd):
assert 'configure: error: cannot run C compiled programs.' in msg assert 'configure: error: cannot run C compiled programs.' in msg
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_build_warning_output(tmpdir, mock_fetch, install_mockery, capfd): def test_build_warning_output(tmpdir, mock_fetch, install_mockery, capfd):
with capfd.disabled(): with capfd.disabled():
@ -682,6 +714,7 @@ def test_build_warning_output(tmpdir, mock_fetch, install_mockery, capfd):
assert 'foo.c:89: warning: some weird warning!' in msg assert 'foo.c:89: warning: some weird warning!' in msg
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_cache_only_fails(tmpdir, mock_fetch, install_mockery, capfd): def test_cache_only_fails(tmpdir, mock_fetch, install_mockery, capfd):
# libelf from cache fails to install, which automatically removes the # libelf from cache fails to install, which automatically removes the
# the libdwarf build task # the libdwarf build task
@ -698,6 +731,7 @@ def test_cache_only_fails(tmpdir, mock_fetch, install_mockery, capfd):
assert 'libdwarf' in failure_lock_prefixes assert 'libdwarf' in failure_lock_prefixes
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_install_only_dependencies(tmpdir, mock_fetch, install_mockery): def test_install_only_dependencies(tmpdir, mock_fetch, install_mockery):
dep = Spec('dependency-install').concretized() dep = Spec('dependency-install').concretized()
root = Spec('dependent-install').concretized() root = Spec('dependent-install').concretized()
@ -708,6 +742,7 @@ def test_install_only_dependencies(tmpdir, mock_fetch, install_mockery):
assert not os.path.exists(root.prefix) assert not os.path.exists(root.prefix)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_install_only_package(tmpdir, mock_fetch, install_mockery, capfd): def test_install_only_package(tmpdir, mock_fetch, install_mockery, capfd):
msg = '' msg = ''
with capfd.disabled(): with capfd.disabled():
@ -720,6 +755,7 @@ def test_install_only_package(tmpdir, mock_fetch, install_mockery, capfd):
assert '1 uninstalled dependency' in msg assert '1 uninstalled dependency' in msg
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_install_deps_then_package(tmpdir, mock_fetch, install_mockery): def test_install_deps_then_package(tmpdir, mock_fetch, install_mockery):
dep = Spec('dependency-install').concretized() dep = Spec('dependency-install').concretized()
root = Spec('dependent-install').concretized() root = Spec('dependent-install').concretized()
@ -732,6 +768,7 @@ def test_install_deps_then_package(tmpdir, mock_fetch, install_mockery):
assert os.path.exists(root.prefix) assert os.path.exists(root.prefix)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.regression('12002') @pytest.mark.regression('12002')
def test_install_only_dependencies_in_env(tmpdir, mock_fetch, install_mockery, def test_install_only_dependencies_in_env(tmpdir, mock_fetch, install_mockery,
mutable_mock_env_path): mutable_mock_env_path):
@ -747,6 +784,7 @@ def test_install_only_dependencies_in_env(tmpdir, mock_fetch, install_mockery,
assert not os.path.exists(root.prefix) assert not os.path.exists(root.prefix)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.regression('12002') @pytest.mark.regression('12002')
def test_install_only_dependencies_of_all_in_env( def test_install_only_dependencies_of_all_in_env(
tmpdir, mock_fetch, install_mockery, mutable_mock_env_path tmpdir, mock_fetch, install_mockery, mutable_mock_env_path
@ -767,6 +805,7 @@ def test_install_only_dependencies_of_all_in_env(
assert os.path.exists(dep.prefix) assert os.path.exists(dep.prefix)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_install_no_add_in_env(tmpdir, mock_fetch, install_mockery, def test_install_no_add_in_env(tmpdir, mock_fetch, install_mockery,
mutable_mock_env_path): mutable_mock_env_path):
# To test behavior of --no-add option, we create the following environment: # To test behavior of --no-add option, we create the following environment:
@ -873,6 +912,7 @@ def test_install_no_add_in_env(tmpdir, mock_fetch, install_mockery,
assert(not any([s.name == 'bowtie' for s in e.uninstalled_specs()])) assert(not any([s.name == 'bowtie' for s in e.uninstalled_specs()]))
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_install_help_does_not_show_cdash_options(capsys): def test_install_help_does_not_show_cdash_options(capsys):
""" """
Make sure `spack install --help` does not describe CDash arguments Make sure `spack install --help` does not describe CDash arguments
@ -883,6 +923,7 @@ def test_install_help_does_not_show_cdash_options(capsys):
assert 'CDash URL' not in captured.out assert 'CDash URL' not in captured.out
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_install_help_cdash(capsys): def test_install_help_cdash(capsys):
"""Make sure `spack install --help-cdash` describes CDash arguments""" """Make sure `spack install --help-cdash` describes CDash arguments"""
install_cmd = SpackCommand('install') install_cmd = SpackCommand('install')
@ -890,6 +931,7 @@ def test_install_help_cdash(capsys):
assert 'CDash URL' in out assert 'CDash URL' in out
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_cdash_auth_token(tmpdir, mock_fetch, install_mockery, capfd): def test_cdash_auth_token(tmpdir, mock_fetch, install_mockery, capfd):
# capfd interferes with Spack's capturing # capfd interferes with Spack's capturing
@ -904,6 +946,7 @@ def test_cdash_auth_token(tmpdir, mock_fetch, install_mockery, capfd):
assert 'Using CDash auth token from environment' in out assert 'Using CDash auth token from environment' in out
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_cdash_configure_warning(tmpdir, mock_fetch, install_mockery, capfd): def test_cdash_configure_warning(tmpdir, mock_fetch, install_mockery, capfd):
# capfd interferes with Spack's capturing of e.g., Build.xml output # capfd interferes with Spack's capturing of e.g., Build.xml output
@ -923,6 +966,7 @@ def test_cdash_configure_warning(tmpdir, mock_fetch, install_mockery, capfd):
assert 'foo: No such file or directory' in content assert 'foo: No such file or directory' in content
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_compiler_bootstrap( def test_compiler_bootstrap(
install_mockery_mutable_config, mock_packages, mock_fetch, install_mockery_mutable_config, mock_packages, mock_fetch,
mock_archive, mutable_config, monkeypatch): mock_archive, mutable_config, monkeypatch):
@ -935,6 +979,7 @@ def test_compiler_bootstrap(
install('a%gcc@2.0') install('a%gcc@2.0')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_compiler_bootstrap_from_binary_mirror( def test_compiler_bootstrap_from_binary_mirror(
install_mockery_mutable_config, mock_packages, mock_fetch, install_mockery_mutable_config, mock_packages, mock_fetch,
mock_archive, mutable_config, monkeypatch, tmpdir): mock_archive, mutable_config, monkeypatch, tmpdir):
@ -973,6 +1018,7 @@ def test_compiler_bootstrap_from_binary_mirror(
install('--no-cache', '--only', 'package', 'b%gcc@10.2.0') install('--no-cache', '--only', 'package', 'b%gcc@10.2.0')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.regression('16221') @pytest.mark.regression('16221')
def test_compiler_bootstrap_already_installed( def test_compiler_bootstrap_already_installed(
install_mockery_mutable_config, mock_packages, mock_fetch, install_mockery_mutable_config, mock_packages, mock_fetch,
@ -988,6 +1034,7 @@ def test_compiler_bootstrap_already_installed(
install('a%gcc@2.0') install('a%gcc@2.0')
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_install_fails_no_args(tmpdir): def test_install_fails_no_args(tmpdir):
# ensure no spack.yaml in directory # ensure no spack.yaml in directory
with tmpdir.as_cwd(): with tmpdir.as_cwd():
@ -999,6 +1046,7 @@ def test_install_fails_no_args(tmpdir):
assert 'using the `spack.yaml` in this directory' not in output assert 'using the `spack.yaml` in this directory' not in output
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_install_fails_no_args_suggests_env_activation(tmpdir): def test_install_fails_no_args_suggests_env_activation(tmpdir):
# ensure spack.yaml in directory # ensure spack.yaml in directory
tmpdir.ensure('spack.yaml') tmpdir.ensure('spack.yaml')
@ -1024,6 +1072,7 @@ def fake_full_hash(spec):
return default_full_hash(spec) return default_full_hash(spec)
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_cache_install_full_hash_match( def test_cache_install_full_hash_match(
install_mockery_mutable_config, mock_packages, mock_fetch, install_mockery_mutable_config, mock_packages, mock_fetch,
mock_archive, mutable_config, monkeypatch, tmpdir): mock_archive, mutable_config, monkeypatch, tmpdir):
@ -1082,6 +1131,7 @@ def test_cache_install_full_hash_match(
shutil.rmtree(mirror_dir.strpath) shutil.rmtree(mirror_dir.strpath)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_install_env_with_tests_all(tmpdir, mock_packages, mock_fetch, def test_install_env_with_tests_all(tmpdir, mock_packages, mock_fetch,
install_mockery, mutable_mock_env_path): install_mockery, mutable_mock_env_path):
env('create', 'test') env('create', 'test')
@ -1092,6 +1142,7 @@ def test_install_env_with_tests_all(tmpdir, mock_packages, mock_fetch,
assert os.path.exists(test_dep.prefix) assert os.path.exists(test_dep.prefix)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_install_env_with_tests_root(tmpdir, mock_packages, mock_fetch, def test_install_env_with_tests_root(tmpdir, mock_packages, mock_fetch,
install_mockery, mutable_mock_env_path): install_mockery, mutable_mock_env_path):
env('create', 'test') env('create', 'test')

View file

@ -5,6 +5,8 @@
from __future__ import print_function from __future__ import print_function
import os
import pytest import pytest
from llnl.util.filesystem import mkdirp from llnl.util.filesystem import mkdirp
@ -42,7 +44,13 @@ def git_tmp_worktree(tmpdir):
"""Create new worktree in a temporary folder and monkeypatch """Create new worktree in a temporary folder and monkeypatch
spack.paths.prefix to point to it. spack.paths.prefix to point to it.
""" """
worktree_root = str(tmpdir.join("tmp_worktree")) if os.name == 'nt':
long_pth = str(tmpdir).split(os.path.sep)
tmp_worktree = os.path.sep.join(long_pth[:-1])
else:
tmp_worktree = str(tmpdir)
worktree_root = os.path.sep.join([tmp_worktree, "wrktree"])
mkdirp(worktree_root) mkdirp(worktree_root)
git("worktree", "add", "--detach", worktree_root, "HEAD") git("worktree", "add", "--detach", worktree_root, "HEAD")

View file

@ -5,6 +5,9 @@
import os.path import os.path
import re import re
import sys
import pytest
from llnl.util.filesystem import mkdirp, touch from llnl.util.filesystem import mkdirp, touch
@ -15,6 +18,7 @@
license = SpackCommand('license') license = SpackCommand('license')
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_list_files(): def test_list_files():
files = license('list-files').strip().split('\n') files = license('list-files').strip().split('\n')
assert all(f.startswith(spack.paths.prefix) for f in files) assert all(f.startswith(spack.paths.prefix) for f in files)
@ -22,6 +26,7 @@ def test_list_files():
assert os.path.abspath(__file__) in files assert os.path.abspath(__file__) in files
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_verify(tmpdir): def test_verify(tmpdir):
source_dir = tmpdir.join('lib', 'spack', 'spack') source_dir = tmpdir.join('lib', 'spack', 'spack')
mkdirp(str(source_dir)) mkdirp(str(source_dir))
@ -69,6 +74,7 @@ def test_verify(tmpdir):
assert license.returncode == 1 assert license.returncode == 1
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_update_copyright_year(tmpdir): def test_update_copyright_year(tmpdir):
source_dir = tmpdir.join('lib', 'spack', 'spack') source_dir = tmpdir.join('lib', 'spack', 'spack')
mkdirp(str(source_dir)) mkdirp(str(source_dir))

View file

@ -3,17 +3,23 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest
from spack.main import SpackCommand from spack.main import SpackCommand
list = SpackCommand('list') list = SpackCommand('list')
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_list(): def test_list():
output = list() output = list()
assert 'cloverleaf3d' in output assert 'cloverleaf3d' in output
assert 'hdf5' in output assert 'hdf5' in output
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_list_filter(mock_packages): def test_list_filter(mock_packages):
output = list('py-*') output = list('py-*')
assert 'py-extension1' in output assert 'py-extension1' in output
@ -30,17 +36,20 @@ def test_list_filter(mock_packages):
assert 'mpich' not in output assert 'mpich' not in output
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_list_search_description(mock_packages): def test_list_search_description(mock_packages):
output = list('--search-description', 'one build dependency') output = list('--search-description', 'one build dependency')
assert 'depb' in output assert 'depb' in output
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_list_format_name_only(mock_packages): def test_list_format_name_only(mock_packages):
output = list('--format', 'name_only') output = list('--format', 'name_only')
assert 'zmpi' in output assert 'zmpi' in output
assert 'hdf5' in output assert 'hdf5' in output
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_list_format_version_json(mock_packages): def test_list_format_version_json(mock_packages):
output = list('--format', 'version_json') output = list('--format', 'version_json')
assert '{"name": "zmpi",' in output assert '{"name": "zmpi",' in output
@ -49,6 +58,7 @@ def test_list_format_version_json(mock_packages):
json.loads(output) json.loads(output)
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_list_format_html(mock_packages): def test_list_format_html(mock_packages):
output = list('--format', 'html') output = list('--format', 'html')
assert '<div class="section" id="zmpi">' in output assert '<div class="section" id="zmpi">' in output

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os import os
import re import re
import sys
import pytest import pytest
@ -17,6 +18,7 @@
location = SpackCommand('location') location = SpackCommand('location')
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_manpath_trailing_colon(install_mockery, mock_fetch, mock_archive, def test_manpath_trailing_colon(install_mockery, mock_fetch, mock_archive,
mock_packages, working_env): mock_packages, working_env):
"""Test that the commands generated by load add the MANPATH prefix """Test that the commands generated by load add the MANPATH prefix
@ -35,6 +37,7 @@ def test_manpath_trailing_colon(install_mockery, mock_fetch, mock_archive,
assert any(re.match(r'export MANPATH=.*:/tmp/man:;', ln) for ln in lines) assert any(re.match(r'export MANPATH=.*:/tmp/man:;', ln) for ln in lines)
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_load(install_mockery, mock_fetch, mock_archive, mock_packages): def test_load(install_mockery, mock_fetch, mock_archive, mock_packages):
"""Test that the commands generated by load add the specified prefix """Test that the commands generated by load add the specified prefix
inspections. Also test that Spack records loaded specs by hash in the inspections. Also test that Spack records loaded specs by hash in the
@ -65,6 +68,7 @@ def test_load(install_mockery, mock_fetch, mock_archive, mock_packages):
assert csh_hash_test in csh_out assert csh_hash_test in csh_out
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_load_recursive(install_mockery, mock_fetch, mock_archive, def test_load_recursive(install_mockery, mock_fetch, mock_archive,
mock_packages): mock_packages):
"""Test that the '-r' option to the load command prepends dependency prefix """Test that the '-r' option to the load command prepends dependency prefix
@ -93,6 +97,7 @@ def test_load_recursive(install_mockery, mock_fetch, mock_archive,
assert csh_hash_test in csh_out assert csh_hash_test in csh_out
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_load_includes_run_env(install_mockery, mock_fetch, mock_archive, def test_load_includes_run_env(install_mockery, mock_fetch, mock_archive,
mock_packages): mock_packages):
"""Tests that environment changes from the package's """Tests that environment changes from the package's
@ -107,6 +112,7 @@ def test_load_includes_run_env(install_mockery, mock_fetch, mock_archive,
assert 'setenv FOOBAR mpileaks' in csh_out assert 'setenv FOOBAR mpileaks' in csh_out
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_load_first(install_mockery, mock_fetch, mock_archive, mock_packages): def test_load_first(install_mockery, mock_fetch, mock_archive, mock_packages):
"""Test with and without the --first option""" """Test with and without the --first option"""
install('libelf@0.8.12') install('libelf@0.8.12')
@ -119,6 +125,7 @@ def test_load_first(install_mockery, mock_fetch, mock_archive, mock_packages):
load('--sh', '--first', 'libelf') load('--sh', '--first', 'libelf')
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_load_fails_no_shell(install_mockery, mock_fetch, mock_archive, def test_load_fails_no_shell(install_mockery, mock_fetch, mock_archive,
mock_packages): mock_packages):
"""Test that spack load prints an error message without a shell.""" """Test that spack load prints an error message without a shell."""
@ -128,6 +135,7 @@ def test_load_fails_no_shell(install_mockery, mock_fetch, mock_archive,
assert "To set up shell support" in out assert "To set up shell support" in out
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_unload(install_mockery, mock_fetch, mock_archive, mock_packages, def test_unload(install_mockery, mock_fetch, mock_archive, mock_packages,
working_env): working_env):
"""Tests that any variables set in the user environment are undone by the """Tests that any variables set in the user environment are undone by the
@ -150,6 +158,7 @@ def test_unload(install_mockery, mock_fetch, mock_archive, mock_packages,
assert 'setenv %s garbage' % uenv.spack_loaded_hashes_var in csh_out assert 'setenv %s garbage' % uenv.spack_loaded_hashes_var in csh_out
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_unload_fails_no_shell(install_mockery, mock_fetch, mock_archive, def test_unload_fails_no_shell(install_mockery, mock_fetch, mock_archive,
mock_packages, working_env): mock_packages, working_env):
"""Test that spack unload prints an error message without a shell.""" """Test that spack unload prints an error message without a shell."""

View file

@ -5,6 +5,7 @@
import os import os
import shutil import shutil
import sys
import pytest import pytest
@ -37,12 +38,14 @@ def mock_spec():
shutil.rmtree(pkg.stage.path) shutil.rmtree(pkg.stage.path)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_location_build_dir(mock_spec): def test_location_build_dir(mock_spec):
"""Tests spack location --build-dir.""" """Tests spack location --build-dir."""
spec, pkg = mock_spec spec, pkg = mock_spec
assert location('--build-dir', spec.name).strip() == pkg.stage.source_path assert location('--build-dir', spec.name).strip() == pkg.stage.source_path
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.regression('22738') @pytest.mark.regression('22738')
def test_location_source_dir(mock_spec): def test_location_source_dir(mock_spec):
"""Tests spack location --source-dir.""" """Tests spack location --source-dir."""
@ -51,6 +54,7 @@ def test_location_source_dir(mock_spec):
assert location(spec.name).strip() == pkg.stage.source_path assert location(spec.name).strip() == pkg.stage.source_path
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_location_source_dir_missing(): def test_location_source_dir_missing():
"""Tests spack location --source-dir with a missing source directory.""" """Tests spack location --source-dir with a missing source directory."""
spec = 'mpileaks' spec = 'mpileaks'
@ -61,6 +65,7 @@ def test_location_source_dir_missing():
assert out == expected assert out == expected
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.parametrize('options', [([]), @pytest.mark.parametrize('options', [([]),
(['--source-dir', 'mpileaks']), (['--source-dir', 'mpileaks']),
(['--env', 'missing-env']), (['--env', 'missing-env']),
@ -71,6 +76,7 @@ def test_location_cmd_error(options):
location(*options) location(*options)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_location_env_exists(mutable_mock_env_path): def test_location_env_exists(mutable_mock_env_path):
"""Tests spack location --env <name> for an existing environment.""" """Tests spack location --env <name> for an existing environment."""
e = ev.create("example") e = ev.create("example")
@ -78,6 +84,7 @@ def test_location_env_exists(mutable_mock_env_path):
assert location('--env', "example").strip() == e.path assert location('--env', "example").strip() == e.path
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_location_with_active_env(mutable_mock_env_path): def test_location_with_active_env(mutable_mock_env_path):
"""Tests spack location --env with active env""" """Tests spack location --env with active env"""
e = ev.create("example") e = ev.create("example")
@ -86,6 +93,7 @@ def test_location_with_active_env(mutable_mock_env_path):
assert location('--env').strip() == e.path assert location('--env').strip() == e.path
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_location_env_flag_interference(mutable_mock_env_path, tmpdir): def test_location_env_flag_interference(mutable_mock_env_path, tmpdir):
""" """
Tests that specifying an active environment using `spack -e x location ...` Tests that specifying an active environment using `spack -e x location ...`
@ -107,6 +115,7 @@ def test_location_env_flag_interference(mutable_mock_env_path, tmpdir):
assert 'first_env' not in location('--packages', global_args=global_args) assert 'first_env' not in location('--packages', global_args=global_args)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_location_env_missing(): def test_location_env_missing():
"""Tests spack location --env.""" """Tests spack location --env."""
missing_env_name = 'missing-env' missing_env_name = 'missing-env'
@ -115,6 +124,7 @@ def test_location_env_missing():
assert out == error assert out == error
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
def test_location_install_dir(mock_spec): def test_location_install_dir(mock_spec):
"""Tests spack location --install-dir.""" """Tests spack location --install-dir."""
@ -122,6 +132,7 @@ def test_location_install_dir(mock_spec):
assert location('--install-dir', spec.name).strip() == spec.prefix assert location('--install-dir', spec.name).strip() == spec.prefix
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
def test_location_package_dir(mock_spec): def test_location_package_dir(mock_spec):
"""Tests spack location --package-dir.""" """Tests spack location --package-dir."""
@ -129,6 +140,7 @@ def test_location_package_dir(mock_spec):
assert location('--package-dir', spec.name).strip() == pkg.package_dir assert location('--package-dir', spec.name).strip() == pkg.package_dir
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
@pytest.mark.parametrize('option,expected', [ @pytest.mark.parametrize('option,expected', [
('--module-dir', spack.paths.module_path), ('--module-dir', spack.paths.module_path),
@ -139,6 +151,7 @@ def test_location_paths_options(option, expected):
assert location(option).strip() == expected assert location(option).strip() == expected
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.parametrize('specs,expected', [ @pytest.mark.parametrize('specs,expected', [
([], "You must supply a spec."), ([], "You must supply a spec."),
(['spec1', 'spec2'], "Too many specs. Supply only one.")]) (['spec1', 'spec2'], "Too many specs. Supply only one.")])
@ -148,6 +161,7 @@ def test_location_spec_errors(specs, expected):
assert location(*specs, fail_on_error=False).strip() == error assert location(*specs, fail_on_error=False).strip() == error
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
def test_location_stage_dir(mock_spec): def test_location_stage_dir(mock_spec):
"""Tests spack location --stage-dir.""" """Tests spack location --stage-dir."""
@ -155,6 +169,7 @@ def test_location_stage_dir(mock_spec):
assert location('--stage-dir', spec.name).strip() == pkg.stage.path assert location('--stage-dir', spec.name).strip() == pkg.stage.path
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
def test_location_stages(mock_spec): def test_location_stages(mock_spec):
"""Tests spack location --stages.""" """Tests spack location --stages."""

View file

@ -3,6 +3,8 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest import pytest
import spack.store import spack.store
@ -14,18 +16,21 @@
uninstall = SpackCommand('uninstall') uninstall = SpackCommand('uninstall')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
def test_mark_mode_required(mutable_database): def test_mark_mode_required(mutable_database):
with pytest.raises(SystemExit): with pytest.raises(SystemExit):
mark('-a') mark('-a')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
def test_mark_spec_required(mutable_database): def test_mark_spec_required(mutable_database):
with pytest.raises(SpackCommandError): with pytest.raises(SpackCommandError):
mark('-i') mark('-i')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
def test_mark_all_explicit(mutable_database): def test_mark_all_explicit(mutable_database):
mark('-e', '-a') mark('-e', '-a')
@ -34,6 +39,7 @@ def test_mark_all_explicit(mutable_database):
assert len(all_specs) == 15 assert len(all_specs) == 15
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
def test_mark_all_implicit(mutable_database): def test_mark_all_implicit(mutable_database):
mark('-i', '-a') mark('-i', '-a')
@ -42,6 +48,7 @@ def test_mark_all_implicit(mutable_database):
assert len(all_specs) == 0 assert len(all_specs) == 0
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
def test_mark_one_explicit(mutable_database): def test_mark_one_explicit(mutable_database):
mark('-e', 'libelf') mark('-e', 'libelf')
@ -51,6 +58,7 @@ def test_mark_one_explicit(mutable_database):
assert len(all_specs) == 3 assert len(all_specs) == 3
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
def test_mark_one_implicit(mutable_database): def test_mark_one_implicit(mutable_database):
mark('-i', 'externaltest') mark('-i', 'externaltest')
@ -59,6 +67,7 @@ def test_mark_one_implicit(mutable_database):
assert len(all_specs) == 14 assert len(all_specs) == 14
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
def test_mark_all_implicit_then_explicit(mutable_database): def test_mark_all_implicit_then_explicit(mutable_database):
mark('-i', '-a') mark('-i', '-a')

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os import os
import sys
import pytest import pytest
@ -41,6 +42,8 @@ def tmp_scope():
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
@pytest.mark.regression('8083') @pytest.mark.regression('8083')
@pytest.mark.skipif(sys.platform == 'win32',
reason="MirrorCaches only work with file:// URLs")
def test_regression_8083(tmpdir, capfd, mock_packages, mock_fetch, config): def test_regression_8083(tmpdir, capfd, mock_packages, mock_fetch, config):
with capfd.disabled(): with capfd.disabled():
output = mirror('create', '-d', str(tmpdir), 'externaltool') output = mirror('create', '-d', str(tmpdir), 'externaltool')
@ -48,6 +51,8 @@ def test_regression_8083(tmpdir, capfd, mock_packages, mock_fetch, config):
assert 'as it is an external spec' in output assert 'as it is an external spec' in output
@pytest.mark.skipif(sys.platform == 'win32',
reason="MirrorCaches only work with file:// URLs")
@pytest.mark.regression('12345') @pytest.mark.regression('12345')
def test_mirror_from_env(tmpdir, mock_packages, mock_fetch, config, def test_mirror_from_env(tmpdir, mock_packages, mock_fetch, config,
mutable_mock_env_path): mutable_mock_env_path):
@ -81,6 +86,8 @@ def source_for_pkg_with_hash(mock_packages, tmpdir):
pkg.versions[spack.version.Version('1.0')]['url'] = local_url pkg.versions[spack.version.Version('1.0')]['url'] = local_url
@pytest.mark.skipif(sys.platform == 'win32',
reason="MirrorCaches only work with file:// URLs")
def test_mirror_skip_unstable(tmpdir_factory, mock_packages, config, def test_mirror_skip_unstable(tmpdir_factory, mock_packages, config,
source_for_pkg_with_hash): source_for_pkg_with_hash):
mirror_dir = str(tmpdir_factory.mktemp('mirror-dir')) mirror_dir = str(tmpdir_factory.mktemp('mirror-dir'))
@ -106,6 +113,7 @@ def __init__(self, specs=None, all=False, file=None,
self.exclude_specs = exclude_specs self.exclude_specs = exclude_specs
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_exclude_specs(mock_packages, config): def test_exclude_specs(mock_packages, config):
args = MockMirrorArgs( args = MockMirrorArgs(
specs=['mpich'], specs=['mpich'],
@ -121,6 +129,7 @@ def test_exclude_specs(mock_packages, config):
assert (not expected_exclude & set(mirror_specs)) assert (not expected_exclude & set(mirror_specs))
@pytest.mark.skipif(sys.platform == "win32", reason="Test unsupported on Windows")
def test_exclude_file(mock_packages, tmpdir, config): def test_exclude_file(mock_packages, tmpdir, config):
exclude_path = os.path.join(str(tmpdir), 'test-exclude.txt') exclude_path = os.path.join(str(tmpdir), 'test-exclude.txt')
with open(exclude_path, 'w') as exclude_file: with open(exclude_path, 'w') as exclude_file:
@ -143,6 +152,7 @@ def test_exclude_file(mock_packages, tmpdir, config):
assert (not expected_exclude & set(mirror_specs)) assert (not expected_exclude & set(mirror_specs))
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_mirror_crud(tmp_scope, capsys): def test_mirror_crud(tmp_scope, capsys):
with capsys.disabled(): with capsys.disabled():
mirror('add', '--scope', tmp_scope, 'mirror', 'http://spack.io') mirror('add', '--scope', tmp_scope, 'mirror', 'http://spack.io')
@ -198,6 +208,7 @@ def test_mirror_crud(tmp_scope, capsys):
assert 'No mirrors configured' in output assert 'No mirrors configured' in output
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_mirror_nonexisting(tmp_scope): def test_mirror_nonexisting(tmp_scope):
with pytest.raises(SpackCommandError): with pytest.raises(SpackCommandError):
mirror('remove', '--scope', tmp_scope, 'not-a-mirror') mirror('remove', '--scope', tmp_scope, 'not-a-mirror')
@ -207,6 +218,7 @@ def test_mirror_nonexisting(tmp_scope):
'not-a-mirror', 'http://spack.io') 'not-a-mirror', 'http://spack.io')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_mirror_name_collision(tmp_scope): def test_mirror_name_collision(tmp_scope):
mirror('add', '--scope', tmp_scope, 'first', '1') mirror('add', '--scope', tmp_scope, 'first', '1')
@ -214,6 +226,7 @@ def test_mirror_name_collision(tmp_scope):
mirror('add', '--scope', tmp_scope, 'first', '1') mirror('add', '--scope', tmp_scope, 'first', '1')
@pytest.mark.skipif(sys.platform == 'win32', reason="hangs on windows")
def test_mirror_destroy(install_mockery_mutable_config, def test_mirror_destroy(install_mockery_mutable_config,
mock_packages, mock_fetch, mock_archive, mock_packages, mock_fetch, mock_archive,
mutable_config, monkeypatch, tmpdir): mutable_config, monkeypatch, tmpdir):

View file

@ -5,6 +5,7 @@
import os.path import os.path
import re import re
import sys
import pytest import pytest
@ -59,12 +60,14 @@ def module_type(request):
# TODO : this requires having a separate directory for test modules # TODO : this requires having a separate directory for test modules
# TODO : add tests for loads and find to check the prompt format # TODO : add tests for loads and find to check the prompt format
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
def test_exit_with_failure(database, module_type, failure_args): def test_exit_with_failure(database, module_type, failure_args):
with pytest.raises(spack.main.SpackCommandError): with pytest.raises(spack.main.SpackCommandError):
module(module_type, *failure_args) module(module_type, *failure_args)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
def test_remove_and_add(database, module_type): def test_remove_and_add(database, module_type):
"""Tests adding and removing a tcl module file.""" """Tests adding and removing a tcl module file."""
@ -88,6 +91,7 @@ def test_remove_and_add(database, module_type):
assert os.path.exists(item) assert os.path.exists(item)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
@pytest.mark.parametrize('cli_args', [ @pytest.mark.parametrize('cli_args', [
['libelf'], ['libelf'],
@ -102,6 +106,7 @@ def test_find(database, cli_args, module_type):
module(module_type, *(['find'] + cli_args)) module(module_type, *(['find'] + cli_args))
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
@pytest.mark.usefixtures('database') @pytest.mark.usefixtures('database')
@pytest.mark.regression('2215') @pytest.mark.regression('2215')
@ -121,6 +126,7 @@ def test_find_fails_on_multiple_matches():
assert 'matches multiple packages' in out assert 'matches multiple packages' in out
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
@pytest.mark.usefixtures('database') @pytest.mark.usefixtures('database')
@pytest.mark.regression('2570') @pytest.mark.regression('2570')
@ -131,6 +137,7 @@ def test_find_fails_on_non_existing_packages():
assert 'matches no package' in out assert 'matches no package' in out
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
@pytest.mark.usefixtures('database') @pytest.mark.usefixtures('database')
def test_find_recursive(): def test_find_recursive():
@ -144,6 +151,7 @@ def test_find_recursive():
assert len(out.split()) > 1 assert len(out.split()) > 1
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
def test_find_recursive_blacklisted(database, module_configuration): def test_find_recursive_blacklisted(database, module_configuration):
module_configuration('blacklist') module_configuration('blacklist')
@ -152,6 +160,7 @@ def test_find_recursive_blacklisted(database, module_configuration):
module('lmod', 'find', '-r', 'mpileaks ^mpich') module('lmod', 'find', '-r', 'mpileaks ^mpich')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
def test_loads_recursive_blacklisted(database, module_configuration): def test_loads_recursive_blacklisted(database, module_configuration):
module_configuration('blacklist') module_configuration('blacklist')
@ -176,6 +185,7 @@ def test_loads_recursive_blacklisted(database, module_configuration):
writer_cls = spack.modules.lmod.LmodModulefileWriter writer_cls = spack.modules.lmod.LmodModulefileWriter
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
def test_setdefault_command( def test_setdefault_command(
mutable_database, mutable_config mutable_database, mutable_config

View file

@ -7,6 +7,7 @@
import re import re
import shutil import shutil
import sys
import pytest import pytest
@ -104,6 +105,7 @@ def split(output):
pkg = spack.main.SpackCommand('pkg') pkg = spack.main.SpackCommand('pkg')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_packages_path(): def test_packages_path():
assert (spack.cmd.pkg.packages_path() == assert (spack.cmd.pkg.packages_path() ==
spack.repo.path.get_repo('builtin').packages_path) spack.repo.path.get_repo('builtin').packages_path)
@ -190,6 +192,7 @@ def test_pkg_removed(mock_pkg_git_repo):
assert out == ['pkg-c'] assert out == ['pkg-c']
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_pkg_changed(mock_pkg_git_repo): def test_pkg_changed(mock_pkg_git_repo):
out = split(pkg('changed', 'HEAD^^', 'HEAD^')) out = split(pkg('changed', 'HEAD^^', 'HEAD^'))
assert out == [] assert out == []

View file

@ -4,6 +4,8 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest import pytest
from spack.main import SpackCommand from spack.main import SpackCommand
@ -11,6 +13,7 @@
providers = SpackCommand('providers') providers = SpackCommand('providers')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.parametrize('pkg', [ @pytest.mark.parametrize('pkg', [
('mpi',), ('mpi',),
('mpi@2',), ('mpi@2',),
@ -21,6 +24,7 @@ def test_it_just_runs(pkg):
providers(*pkg) providers(*pkg)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.parametrize('vpkg,provider_list', [ @pytest.mark.parametrize('vpkg,provider_list', [
(('mpi',), ['intel-mpi', (('mpi',), ['intel-mpi',
'intel-parallel-studio', 'intel-parallel-studio',

View file

@ -3,6 +3,9 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os import os
import sys
import pytest
import spack.store import spack.store
from spack.main import SpackCommand from spack.main import SpackCommand
@ -12,6 +15,7 @@
reindex = SpackCommand('reindex') reindex = SpackCommand('reindex')
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_reindex_basic(mock_packages, mock_archive, mock_fetch, def test_reindex_basic(mock_packages, mock_archive, mock_fetch,
install_mockery): install_mockery):
install('libelf@0.8.13') install('libelf@0.8.13')
@ -24,6 +28,7 @@ def test_reindex_basic(mock_packages, mock_archive, mock_fetch,
assert spack.store.db.query() == all_installed assert spack.store.db.query() == all_installed
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_reindex_db_deleted(mock_packages, mock_archive, mock_fetch, def test_reindex_db_deleted(mock_packages, mock_archive, mock_fetch,
install_mockery): install_mockery):
install('libelf@0.8.13') install('libelf@0.8.13')
@ -37,6 +42,7 @@ def test_reindex_db_deleted(mock_packages, mock_archive, mock_fetch,
assert spack.store.db.query() == all_installed assert spack.store.db.query() == all_installed
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_reindex_with_deprecated_packages(mock_packages, mock_archive, def test_reindex_with_deprecated_packages(mock_packages, mock_archive,
mock_fetch, install_mockery): mock_fetch, install_mockery):
install('libelf@0.8.13') install('libelf@0.8.13')

View file

@ -2,6 +2,9 @@
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest
from spack.main import SpackCommand from spack.main import SpackCommand
@ -22,6 +25,7 @@
] ]
@pytest.mark.skipif(sys.platform == 'win32', reason="Hashes do not match")
def test_resource_list(mock_packages, capfd): def test_resource_list(mock_packages, capfd):
with capfd.disabled(): with capfd.disabled():
out = resource('list') out = resource('list')
@ -39,6 +43,7 @@ def test_resource_list(mock_packages, capfd):
assert 'patched by: builtin.mock.patch-a-dependency' in out assert 'patched by: builtin.mock.patch-a-dependency' in out
@pytest.mark.skipif(sys.platform == 'win32', reason="Hashes do not match")
def test_resource_list_only_hashes(mock_packages, capfd): def test_resource_list_only_hashes(mock_packages, capfd):
with capfd.disabled(): with capfd.disabled():
out = resource('list', '--only-hashes') out = resource('list', '--only-hashes')
@ -47,6 +52,7 @@ def test_resource_list_only_hashes(mock_packages, capfd):
assert h in out assert h in out
@pytest.mark.skipif(sys.platform == 'win32', reason="Hashes do not match")
def test_resource_show(mock_packages, capfd): def test_resource_show(mock_packages, capfd):
with capfd.disabled(): with capfd.disabled():
out = resource('show', 'c45c1564f70def3fc1a6e22139f62cb21cd190cc3a7dbe6f4120fa59ce33dcb8') out = resource('show', 'c45c1564f70def3fc1a6e22139f62cb21cd190cc3a7dbe6f4120fa59ce33dcb8')

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os import os
import sys
import pytest import pytest
@ -18,6 +19,7 @@
pytestmark = pytest.mark.usefixtures('install_mockery', 'mock_packages') pytestmark = pytest.mark.usefixtures('install_mockery', 'mock_packages')
@pytest.mark.skipif(sys.platform == 'win32', reason="not implemented on windows")
def test_stage_spec(monkeypatch): def test_stage_spec(monkeypatch):
"""Verify that staging specs works.""" """Verify that staging specs works."""
@ -46,6 +48,7 @@ def fake_stage(pkg, mirror_only=False):
return expected_path return expected_path
@pytest.mark.skipif(sys.platform == 'win32', reason="PermissionError")
def test_stage_path(check_stage_path): def test_stage_path(check_stage_path):
"""Verify that --path only works with single specs.""" """Verify that --path only works with single specs."""
stage('--path={0}'.format(check_stage_path), 'trivial-install-test-package') stage('--path={0}'.format(check_stage_path), 'trivial-install-test-package')
@ -59,6 +62,7 @@ def test_stage_path_errors_multiple_specs(check_stage_path):
'mpileaks') 'mpileaks')
@pytest.mark.skipif(sys.platform == 'win32', reason="not implemented on windows")
def test_stage_with_env_outside_env(mutable_mock_env_path, monkeypatch): def test_stage_with_env_outside_env(mutable_mock_env_path, monkeypatch):
"""Verify that stage concretizes specs not in environment instead of erroring.""" """Verify that stage concretizes specs not in environment instead of erroring."""
@ -76,6 +80,7 @@ def fake_stage(pkg, mirror_only=False):
stage('trivial-install-test-package') stage('trivial-install-test-package')
@pytest.mark.skipif(sys.platform == 'win32', reason="not implemented on windows")
def test_stage_with_env_inside_env(mutable_mock_env_path, monkeypatch): def test_stage_with_env_inside_env(mutable_mock_env_path, monkeypatch):
"""Verify that stage filters specs in environment instead of reconcretizing.""" """Verify that stage filters specs in environment instead of reconcretizing."""
@ -93,6 +98,7 @@ def fake_stage(pkg, mirror_only=False):
stage('mpileaks') stage('mpileaks')
@pytest.mark.skipif(sys.platform == 'win32', reason="not implemented on windows")
def test_stage_full_env(mutable_mock_env_path, monkeypatch): def test_stage_full_env(mutable_mock_env_path, monkeypatch):
"""Verify that stage filters specs in environment.""" """Verify that stage filters specs in environment."""

View file

@ -5,6 +5,7 @@
import filecmp import filecmp
import os import os
import posixpath
import shutil import shutil
import sys import sys
@ -86,7 +87,13 @@ def flake8_package_with_errors(scope="function"):
def test_changed_files(flake8_package): def test_changed_files(flake8_package):
# changed_files returns file paths relative to the root # changed_files returns file paths relative to the root
# directory of Spack. Convert to absolute file paths. # directory of Spack. Convert to absolute file paths.
files = [os.path.join(spack.paths.prefix, path) for path in changed_files()] files = [
os.path.join(spack.paths.prefix, os.path.normpath(path))
for path in changed_files()
]
if sys.platform == "win32":
files = [f.replace("\\", "/") for f in files]
# There will likely be other files that have changed # There will likely be other files that have changed
# when these tests are run # when these tests are run
@ -114,10 +121,13 @@ def test_changed_no_base(tmpdir, capfd):
def test_changed_files_all_files(flake8_package): def test_changed_files_all_files(flake8_package):
# it's hard to guarantee "all files", so do some sanity checks. # it's hard to guarantee "all files", so do some sanity checks.
files = set([ files = set([
os.path.join(spack.paths.prefix, path) os.path.join(spack.paths.prefix, os.path.normpath(path))
for path in changed_files(all_files=True) for path in changed_files(all_files=True)
]) ])
if sys.platform == "win32":
files = [f.replace("\\", "/") for f in files]
# spack has a lot of files -- check that we're in the right ballpark # spack has a lot of files -- check that we're in the right ballpark
assert len(files) > 6000 assert len(files) > 6000
@ -126,13 +136,13 @@ def test_changed_files_all_files(flake8_package):
assert zlib.module.__file__ in files assert zlib.module.__file__ in files
# a core spack file # a core spack file
assert os.path.join(spack.paths.module_path, "spec.py") in files assert posixpath.join(spack.paths.module_path, "spec.py") in files
# a mock package # a mock package
assert flake8_package in files assert flake8_package in files
# this test # this test
assert __file__ in files assert __file__.replace("\\", "/") in files
# ensure externals are excluded # ensure externals are excluded
assert not any(f.startswith(spack.paths.external_path) for f in files) assert not any(f.startswith(spack.paths.external_path) for f in files)

View file

@ -5,6 +5,7 @@
import argparse import argparse
import os import os
import sys
import pytest import pytest
@ -18,6 +19,8 @@
spack_test = SpackCommand('test') spack_test = SpackCommand('test')
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_test_package_not_installed( def test_test_package_not_installed(
tmpdir, mock_packages, mock_archive, mock_fetch, config, tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery_mutable_config, mock_test_stage): install_mockery_mutable_config, mock_test_stage):
@ -39,6 +42,8 @@ def test_test_dirty_flag(arguments, expected):
assert args.dirty == expected assert args.dirty == expected
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_test_dup_alias( def test_test_dup_alias(
mock_test_stage, mock_packages, mock_archive, mock_fetch, mock_test_stage, mock_packages, mock_archive, mock_fetch,
install_mockery_mutable_config, capfd): install_mockery_mutable_config, capfd):
@ -57,6 +62,8 @@ def test_test_dup_alias(
assert "already exists" in out assert "already exists" in out
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_test_output(mock_test_stage, mock_packages, mock_archive, mock_fetch, def test_test_output(mock_test_stage, mock_packages, mock_archive, mock_fetch,
install_mockery_mutable_config): install_mockery_mutable_config):
"""Ensure output printed from pkgs is captured by output redirection.""" """Ensure output printed from pkgs is captured by output redirection."""
@ -82,6 +89,8 @@ def test_test_output(mock_test_stage, mock_packages, mock_archive, mock_fetch,
assert "FAILED" not in output assert "FAILED" not in output
@pytest.mark.skipif(sys.platform == "win32",
reason='FetchError: All fetchers failed')
def test_test_output_on_error( def test_test_output_on_error(
mock_packages, mock_archive, mock_fetch, install_mockery_mutable_config, mock_packages, mock_archive, mock_fetch, install_mockery_mutable_config,
capfd, mock_test_stage capfd, mock_test_stage
@ -95,6 +104,8 @@ def test_test_output_on_error(
assert "Command exited with status 1" in out assert "Command exited with status 1" in out
@pytest.mark.skipif(sys.platform == "win32",
reason='FetchError: All fetchers failed')
def test_test_output_on_failure( def test_test_output_on_failure(
mock_packages, mock_archive, mock_fetch, install_mockery_mutable_config, mock_packages, mock_archive, mock_fetch, install_mockery_mutable_config,
capfd, mock_test_stage capfd, mock_test_stage
@ -107,6 +118,8 @@ def test_test_output_on_failure(
assert "TestFailure" in out assert "TestFailure" in out
@pytest.mark.skipif(sys.platform == "win32",
reason='FetchError: All fetchers failed')
def test_show_log_on_error( def test_show_log_on_error(
mock_packages, mock_archive, mock_fetch, mock_packages, mock_archive, mock_fetch,
install_mockery_mutable_config, capfd, mock_test_stage install_mockery_mutable_config, capfd, mock_test_stage
@ -120,6 +133,8 @@ def test_show_log_on_error(
assert mock_test_stage in out assert mock_test_stage in out
@pytest.mark.skipif(sys.platform == "win32",
reason='FetchError: All fetchers failed')
@pytest.mark.usefixtures( @pytest.mark.usefixtures(
'mock_packages', 'mock_archive', 'mock_fetch', 'mock_packages', 'mock_archive', 'mock_fetch',
'install_mockery_mutable_config' 'install_mockery_mutable_config'
@ -153,6 +168,8 @@ def test_junit_output_with_failures(tmpdir, mock_test_stage, pkg_name, msgs):
assert msg in content assert msg in content
@pytest.mark.skipif(sys.platform == "win32",
reason='FetchError: All fetchers failed')
def test_cdash_output_test_error( def test_cdash_output_test_error(
tmpdir, mock_fetch, install_mockery_mutable_config, mock_packages, tmpdir, mock_fetch, install_mockery_mutable_config, mock_packages,
mock_archive, mock_test_stage, capfd): mock_archive, mock_test_stage, capfd):
@ -172,6 +189,8 @@ def test_cdash_output_test_error(
assert 'FAILED: Command exited with status 1' in content assert 'FAILED: Command exited with status 1' in content
@pytest.mark.skipif(sys.platform == "win32",
reason='FetchError: All fetchers failed')
def test_cdash_upload_clean_test( def test_cdash_upload_clean_test(
tmpdir, mock_fetch, install_mockery_mutable_config, mock_packages, tmpdir, mock_fetch, install_mockery_mutable_config, mock_packages,
mock_archive, mock_test_stage): mock_archive, mock_test_stage):
@ -217,6 +236,8 @@ def test_test_list_all(mock_packages):
]) ])
@pytest.mark.skipif(sys.platform == "win32",
reason='FetchError: All fetchers failed')
def test_test_list( def test_test_list(
mock_packages, mock_archive, mock_fetch, install_mockery_mutable_config mock_packages, mock_archive, mock_fetch, install_mockery_mutable_config
): ):
@ -226,6 +247,18 @@ def test_test_list(
assert pkg_with_tests in output assert pkg_with_tests in output
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_has_test_method_fails(capsys):
with pytest.raises(SystemExit):
has_test_method('printing-package')
captured = capsys.readouterr()[1]
assert 'is not a class' in captured
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_hash_change(mock_test_stage, mock_packages, mock_archive, mock_fetch, def test_hash_change(mock_test_stage, mock_packages, mock_archive, mock_fetch,
install_mockery_mutable_config): install_mockery_mutable_config):
"""Ensure output printed from pkgs is captured by output redirection.""" """Ensure output printed from pkgs is captured by output redirection."""

View file

@ -3,6 +3,10 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest
import spack.environment as ev import spack.environment as ev
import spack.spec import spack.spec
from spack.main import SpackCommand from spack.main import SpackCommand
@ -12,6 +16,8 @@
concretize = SpackCommand('concretize') concretize = SpackCommand('concretize')
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_undevelop(tmpdir, config, mock_packages, mutable_mock_env_path): def test_undevelop(tmpdir, config, mock_packages, mutable_mock_env_path):
# setup environment # setup environment
envdir = tmpdir.mkdir('env') envdir = tmpdir.mkdir('env')
@ -39,6 +45,8 @@ def test_undevelop(tmpdir, config, mock_packages, mutable_mock_env_path):
assert not after.satisfies('dev_path=*') assert not after.satisfies('dev_path=*')
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
def test_undevelop_nonexistent(tmpdir, config, mock_packages, mutable_mock_env_path): def test_undevelop_nonexistent(tmpdir, config, mock_packages, mutable_mock_env_path):
# setup environment # setup environment
envdir = tmpdir.mkdir('env') envdir = tmpdir.mkdir('env')

View file

@ -3,6 +3,8 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest import pytest
import llnl.util.tty as tty import llnl.util.tty as tty
@ -24,6 +26,7 @@ def __init__(self, packages, all=False, force=False, dependents=False):
self.yes_to_all = True self.yes_to_all = True
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
def test_multiple_matches(mutable_database): def test_multiple_matches(mutable_database):
"""Test unable to uninstall when multiple matches.""" """Test unable to uninstall when multiple matches."""
@ -31,6 +34,7 @@ def test_multiple_matches(mutable_database):
uninstall('-y', 'mpileaks') uninstall('-y', 'mpileaks')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
def test_installed_dependents(mutable_database): def test_installed_dependents(mutable_database):
"""Test can't uninstall when there are installed dependents.""" """Test can't uninstall when there are installed dependents."""
@ -38,6 +42,7 @@ def test_installed_dependents(mutable_database):
uninstall('-y', 'libelf') uninstall('-y', 'libelf')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
def test_recursive_uninstall(mutable_database): def test_recursive_uninstall(mutable_database):
"""Test recursive uninstall.""" """Test recursive uninstall."""
@ -55,6 +60,7 @@ def test_recursive_uninstall(mutable_database):
assert len(mpi_specs) == 3 assert len(mpi_specs) == 3
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
@pytest.mark.regression('3690') @pytest.mark.regression('3690')
@pytest.mark.parametrize('constraint,expected_number_of_specs', [ @pytest.mark.parametrize('constraint,expected_number_of_specs', [
@ -69,6 +75,7 @@ def test_uninstall_spec_with_multiple_roots(
assert len(all_specs) == expected_number_of_specs assert len(all_specs) == expected_number_of_specs
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
@pytest.mark.parametrize('constraint,expected_number_of_specs', [ @pytest.mark.parametrize('constraint,expected_number_of_specs', [
('dyninst', 14), ('libelf', 14) ('dyninst', 14), ('libelf', 14)
@ -82,6 +89,7 @@ def test_force_uninstall_spec_with_ref_count_not_zero(
assert len(all_specs) == expected_number_of_specs assert len(all_specs) == expected_number_of_specs
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
def test_force_uninstall_and_reinstall_by_hash(mutable_database): def test_force_uninstall_and_reinstall_by_hash(mutable_database):
"""Test forced uninstall and reinstall of old specs.""" """Test forced uninstall and reinstall of old specs."""
@ -161,6 +169,7 @@ def db_specs():
assert len(mpi_specs) == 3 assert len(mpi_specs) == 3
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.db @pytest.mark.db
@pytest.mark.regression('15773') @pytest.mark.regression('15773')
def test_in_memory_consistency_when_uninstalling( def test_in_memory_consistency_when_uninstalling(

View file

@ -124,6 +124,10 @@ def test_url_summary(mock_packages):
assert out_correct_versions == correct_versions assert out_correct_versions == correct_versions
@pytest.mark.skipif(
sys.platform.startswith("win"),
reason="Unsupported on Windows for now"
)
def test_url_stats(capfd, mock_packages): def test_url_stats(capfd, mock_packages):
with capfd.disabled(): with capfd.disabled():
output = url('stats') output = url('stats')

View file

@ -5,6 +5,9 @@
"""Tests for the `spack verify` command""" """Tests for the `spack verify` command"""
import os import os
import sys
import pytest
import llnl.util.filesystem as fs import llnl.util.filesystem as fs
@ -18,6 +21,7 @@
install = SpackCommand('install') install = SpackCommand('install')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_single_file_verify_cmd(tmpdir): def test_single_file_verify_cmd(tmpdir):
# Test the verify command interface to verifying a single file. # Test the verify command interface to verifying a single file.
filedir = os.path.join(str(tmpdir), 'a', 'b', 'c', 'd') filedir = os.path.join(str(tmpdir), 'a', 'b', 'c', 'd')
@ -64,6 +68,7 @@ def test_single_file_verify_cmd(tmpdir):
assert sorted(errors) == sorted(expected) assert sorted(errors) == sorted(expected)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_single_spec_verify_cmd(tmpdir, mock_packages, mock_archive, def test_single_spec_verify_cmd(tmpdir, mock_packages, mock_archive,
mock_fetch, config, install_mockery): mock_fetch, config, install_mockery):
# Test the verify command interface to verify a single spec # Test the verify command interface to verify a single spec

View file

@ -3,6 +3,8 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest import pytest
from spack.main import SpackCommand from spack.main import SpackCommand
@ -11,6 +13,7 @@
versions = SpackCommand('versions') versions = SpackCommand('versions')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_safe_only_versions(): def test_safe_only_versions():
"""Only test the safe versions of a package. """Only test the safe versions of a package.
(Using the deprecated command line argument) (Using the deprecated command line argument)
@ -18,12 +21,14 @@ def test_safe_only_versions():
versions('--safe-only', 'zlib') versions('--safe-only', 'zlib')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_safe_versions(): def test_safe_versions():
"""Only test the safe versions of a package.""" """Only test the safe versions of a package."""
versions('--safe', 'zlib') versions('--safe', 'zlib')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.maybeslow @pytest.mark.maybeslow
def test_remote_versions(): def test_remote_versions():
"""Test a package for which remote versions should be available.""" """Test a package for which remote versions should be available."""
@ -31,6 +36,7 @@ def test_remote_versions():
versions('zlib') versions('zlib')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.maybeslow @pytest.mark.maybeslow
def test_remote_versions_only(): def test_remote_versions_only():
"""Test a package for which remote versions should be available.""" """Test a package for which remote versions should be available."""
@ -38,6 +44,7 @@ def test_remote_versions_only():
versions('--remote', 'zlib') versions('--remote', 'zlib')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.usefixtures('mock_packages') @pytest.mark.usefixtures('mock_packages')
def test_new_versions_only(monkeypatch): def test_new_versions_only(monkeypatch):
"""Test a package for which new versions should be available.""" """Test a package for which new versions should be available."""
@ -66,6 +73,7 @@ def mock_fetch_remote_versions(*args, **kwargs):
assert(v.strip(' \n\t') == "99.99.99\n 3.2.1") assert(v.strip(' \n\t') == "99.99.99\n 3.2.1")
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.maybeslow @pytest.mark.maybeslow
def test_no_versions(): def test_no_versions():
"""Test a package for which no remote versions are available.""" """Test a package for which no remote versions are available."""
@ -73,6 +81,7 @@ def test_no_versions():
versions('converge') versions('converge')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.maybeslow @pytest.mark.maybeslow
def test_no_unchecksummed_versions(): def test_no_unchecksummed_versions():
"""Test a package for which no unchecksummed versions are available.""" """Test a package for which no unchecksummed versions are available."""
@ -80,6 +89,7 @@ def test_no_unchecksummed_versions():
versions('bzip2') versions('bzip2')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.maybeslow @pytest.mark.maybeslow
def test_versions_no_url(): def test_versions_no_url():
"""Test a package with versions but without a ``url`` attribute.""" """Test a package with versions but without a ``url`` attribute."""
@ -87,6 +97,7 @@ def test_versions_no_url():
versions('graphviz') versions('graphviz')
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.maybeslow @pytest.mark.maybeslow
def test_no_versions_no_url(): def test_no_versions_no_url():
"""Test a package without versions or a ``url`` attribute.""" """Test a package without versions or a ``url`` attribute."""

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os.path import os.path
import sys
import pytest import pytest
@ -25,6 +26,7 @@ def create_projection_file(tmpdir, projection):
return projection_file return projection_file
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.parametrize('cmd', ['hardlink', 'symlink', 'hard', 'add', @pytest.mark.parametrize('cmd', ['hardlink', 'symlink', 'hard', 'add',
'copy', 'relocate']) 'copy', 'relocate'])
def test_view_link_type( def test_view_link_type(
@ -41,6 +43,7 @@ def test_view_link_type(
assert os.path.islink(package_prefix) == is_link_cmd assert os.path.islink(package_prefix) == is_link_cmd
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.parametrize('add_cmd', ['hardlink', 'symlink', 'hard', 'add', @pytest.mark.parametrize('add_cmd', ['hardlink', 'symlink', 'hard', 'add',
'copy', 'relocate']) 'copy', 'relocate'])
def test_view_link_type_remove( def test_view_link_type_remove(
@ -56,6 +59,7 @@ def test_view_link_type_remove(
assert not os.path.exists(bindir) assert not os.path.exists(bindir)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
@pytest.mark.parametrize('cmd', ['hardlink', 'symlink', 'hard', 'add', @pytest.mark.parametrize('cmd', ['hardlink', 'symlink', 'hard', 'add',
'copy', 'relocate']) 'copy', 'relocate'])
def test_view_projections( def test_view_projections(
@ -81,6 +85,7 @@ def test_view_projections(
assert os.path.islink(package_prefix) == is_symlink_cmd assert os.path.islink(package_prefix) == is_symlink_cmd
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_view_multiple_projections( def test_view_multiple_projections(
tmpdir, mock_packages, mock_archive, mock_fetch, config, tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery): install_mockery):
@ -103,6 +108,7 @@ def test_view_multiple_projections(
assert os.path.exists(extendee_prefix) assert os.path.exists(extendee_prefix)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_view_multiple_projections_all_first( def test_view_multiple_projections_all_first(
tmpdir, mock_packages, mock_archive, mock_fetch, config, tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery): install_mockery):
@ -125,6 +131,7 @@ def test_view_multiple_projections_all_first(
assert os.path.exists(extendee_prefix) assert os.path.exists(extendee_prefix)
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_view_external( def test_view_external(
tmpdir, mock_packages, mock_archive, mock_fetch, config, tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery): install_mockery):
@ -134,6 +141,7 @@ def test_view_external(
assert 'Skipping external package: externaltool' in output assert 'Skipping external package: externaltool' in output
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_view_extension( def test_view_extension(
tmpdir, mock_packages, mock_archive, mock_fetch, config, tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery): install_mockery):
@ -160,6 +168,7 @@ def test_view_extension(
assert os.path.exists(os.path.join(viewpath, 'bin', 'extension1')) assert os.path.exists(os.path.join(viewpath, 'bin', 'extension1'))
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_view_extension_projection( def test_view_extension_projection(
tmpdir, mock_packages, mock_archive, mock_fetch, config, tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery): install_mockery):
@ -193,6 +202,7 @@ def test_view_extension_projection(
'bin', 'extension1')) 'bin', 'extension1'))
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_view_extension_remove( def test_view_extension_remove(
tmpdir, mock_packages, mock_archive, mock_fetch, config, tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery): install_mockery):
@ -212,6 +222,7 @@ def test_view_extension_remove(
assert not os.path.exists(os.path.join(viewpath, 'bin', 'extension1')) assert not os.path.exists(os.path.join(viewpath, 'bin', 'extension1'))
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_view_extension_conflict( def test_view_extension_conflict(
tmpdir, mock_packages, mock_archive, mock_fetch, config, tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery): install_mockery):
@ -224,6 +235,7 @@ def test_view_extension_conflict(
assert 'Package conflict detected' in output assert 'Package conflict detected' in output
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_view_extension_conflict_ignored( def test_view_extension_conflict_ignored(
tmpdir, mock_packages, mock_archive, mock_fetch, config, tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery): install_mockery):
@ -237,6 +249,7 @@ def test_view_extension_conflict_ignored(
assert fin.read() == '1.0' assert fin.read() == '1.0'
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_view_extension_global_activation( def test_view_extension_global_activation(
tmpdir, mock_packages, mock_archive, mock_fetch, config, tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery): install_mockery):
@ -266,6 +279,7 @@ def test_view_extension_global_activation(
assert not os.path.exists(os.path.join(viewpath, 'bin', 'extension2')) assert not os.path.exists(os.path.join(viewpath, 'bin', 'extension2'))
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_view_extendee_with_global_activations( def test_view_extendee_with_global_activations(
tmpdir, mock_packages, mock_archive, mock_fetch, config, tmpdir, mock_packages, mock_archive, mock_fetch, config,
install_mockery): install_mockery):
@ -279,6 +293,7 @@ def test_view_extendee_with_global_activations(
assert 'Error: Globally activated extensions cannot be used' in output assert 'Error: Globally activated extensions cannot be used' in output
@pytest.mark.skipif(sys.platform == 'win32', reason="Error on Win")
def test_view_fails_with_missing_projections_file(tmpdir): def test_view_fails_with_missing_projections_file(tmpdir):
viewpath = str(tmpdir.mkdir('view')) viewpath = str(tmpdir.mkdir('view'))
projection_file = os.path.join(str(tmpdir), 'nonexistent') projection_file = os.path.join(str(tmpdir), 'nonexistent')

View file

@ -212,6 +212,8 @@ def call_compiler(exe, *args, **kwargs):
return no_flag_output return no_flag_output
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize('exe,flagname', [ @pytest.mark.parametrize('exe,flagname', [
('cxx', ''), ('cxx', ''),
('cxx', 'cxxflags'), ('cxx', 'cxxflags'),
@ -265,6 +267,8 @@ def test_get_compiler_link_paths_no_verbose_flag():
assert dirs == [] assert dirs == []
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.enable_compiler_link_paths @pytest.mark.enable_compiler_link_paths
def test_get_compiler_link_paths_load_env(working_env, monkeypatch, tmpdir): def test_get_compiler_link_paths_load_env(working_env, monkeypatch, tmpdir):
gcc = str(tmpdir.join('gcc')) gcc = str(tmpdir.join('gcc'))
@ -697,6 +701,8 @@ def test_raising_if_compiler_target_is_over_specific(config):
spack.compilers.get_compilers(cfg, 'gcc@9.0.1', arch_spec) spack.compilers.get_compilers(cfg, 'gcc@9.0.1', arch_spec)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_compiler_get_real_version(working_env, monkeypatch, tmpdir): def test_compiler_get_real_version(working_env, monkeypatch, tmpdir):
# Test variables # Test variables
test_version = '2.2.2' test_version = '2.2.2'
@ -806,6 +812,8 @@ def _call(*args, **kwargs):
assert 'SPACK_TEST_CMP_ON' not in os.environ assert 'SPACK_TEST_CMP_ON' not in os.environ
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_compiler_flags_use_real_version(working_env, monkeypatch, tmpdir): def test_compiler_flags_use_real_version(working_env, monkeypatch, tmpdir):
# Create compiler # Create compiler
gcc = str(tmpdir.join('gcc')) gcc = str(tmpdir.join('gcc'))
@ -841,6 +849,8 @@ def test_compiler_flags_use_real_version(working_env, monkeypatch, tmpdir):
assert flag == '-std=c++0x' assert flag == '-std=c++0x'
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_apple_clang_setup_environment(mock_executable, monkeypatch): def test_apple_clang_setup_environment(mock_executable, monkeypatch):
"""Test a code path that is taken only if the package uses """Test a code path that is taken only if the package uses
Xcode on MacOS. Xcode on MacOS.
@ -902,6 +912,8 @@ def _listdir(path):
assert env.env_modifications[2].name == 'DEVELOPER_DIR' assert env.env_modifications[2].name == 'DEVELOPER_DIR'
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize('xcode_select_output', [ @pytest.mark.parametrize('xcode_select_output', [
'', '/Library/Developer/CommandLineTools' '', '/Library/Developer/CommandLineTools'
]) ])

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""Test detection of compiler version""" """Test detection of compiler version"""
import os import os
import sys
import pytest import pytest
@ -320,6 +321,8 @@ def test_xl_version_detection(version_str, expected_version):
assert version == expected_version assert version == expected_version
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize('compiler,version', [ @pytest.mark.parametrize('compiler,version', [
('gcc', '8.1.0'), ('gcc', '8.1.0'),
('gcc', '1.0.0-foo'), ('gcc', '1.0.0-foo'),

View file

@ -166,6 +166,8 @@ def change(self, context):
return _changing_pkg return _changing_pkg
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
# This must use the mutable_config fixture because the test # This must use the mutable_config fixture because the test
# adjusting_default_target_based_on_compiler uses the current_host fixture, # adjusting_default_target_based_on_compiler uses the current_host fixture,
# which changes the config. # which changes the config.
@ -367,6 +369,8 @@ def test_concretize_two_virtuals_with_dual_provider_and_a_conflict(
with pytest.raises(spack.error.SpackError): with pytest.raises(spack.error.SpackError):
s.concretize() s.concretize()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_no_matching_compiler_specs(self, mock_low_high_config): def test_no_matching_compiler_specs(self, mock_low_high_config):
# only relevant when not building compilers as needed # only relevant when not building compilers as needed
with spack.concretize.enable_compiler_existence_check(): with spack.concretize.enable_compiler_existence_check():
@ -429,6 +433,8 @@ def test_compiler_inheritance(self, compiler_str):
assert spec['libdwarf'].compiler.satisfies(compiler_str) assert spec['libdwarf'].compiler.satisfies(compiler_str)
assert spec['libelf'].compiler.satisfies(compiler_str) assert spec['libelf'].compiler.satisfies(compiler_str)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_external_package(self): def test_external_package(self):
spec = Spec('externaltool%gcc') spec = Spec('externaltool%gcc')
spec.concretize() spec.concretize()
@ -436,6 +442,8 @@ def test_external_package(self):
assert 'externalprereq' not in spec assert 'externalprereq' not in spec
assert spec['externaltool'].compiler.satisfies('gcc') assert spec['externaltool'].compiler.satisfies('gcc')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_external_package_module(self): def test_external_package_module(self):
# No tcl modules on darwin/linux machines # No tcl modules on darwin/linux machines
# TODO: improved way to check for this. # TODO: improved way to check for this.
@ -457,6 +465,8 @@ def test_nobuild_package(self):
with pytest.raises(spack.error.SpecError): with pytest.raises(spack.error.SpecError):
spec.concretize() spec.concretize()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_external_and_virtual(self): def test_external_and_virtual(self):
spec = Spec('externaltest') spec = Spec('externaltest')
spec.concretize() spec.concretize()
@ -704,6 +714,8 @@ def test_noversion_pkg(self, spec):
with pytest.raises(spack.error.SpackError): with pytest.raises(spack.error.SpackError):
Spec(spec).concretized() Spec(spec).concretized()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
# Include targets to prevent regression on 20537 # Include targets to prevent regression on 20537
@pytest.mark.parametrize('spec, best_achievable', [ @pytest.mark.parametrize('spec, best_achievable', [
('mpileaks%gcc@4.4.7 ^dyninst@10.2.1 target=x86_64:', 'core2'), ('mpileaks%gcc@4.4.7 ^dyninst@10.2.1 target=x86_64:', 'core2'),
@ -722,6 +734,8 @@ def test_adjusting_default_target_based_on_compiler(
s = Spec(spec).concretized() s = Spec(spec).concretized()
assert str(s.architecture.target) == str(expected) assert str(s.architecture.target) == str(expected)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.regression('8735,14730') @pytest.mark.regression('8735,14730')
def test_compiler_version_matches_any_entry_in_compilers_yaml(self): def test_compiler_version_matches_any_entry_in_compilers_yaml(self):
# Ensure that a concrete compiler with different compiler version # Ensure that a concrete compiler with different compiler version
@ -1112,6 +1126,8 @@ def test_custom_compiler_version(self):
s = Spec('a %gcc@foo os=redhat6').concretized() s = Spec('a %gcc@foo os=redhat6').concretized()
assert '%gcc@foo' in s assert '%gcc@foo' in s
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_all_patches_applied(self): def test_all_patches_applied(self):
uuidpatch = 'a60a42b73e03f207433c5579de207c6ed61d58e4d12dd3b5142eb525728d89ea' uuidpatch = 'a60a42b73e03f207433c5579de207c6ed61d58e4d12dd3b5142eb525728d89ea'
localpatch = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' localpatch = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
@ -1149,6 +1165,8 @@ def test_external_package_versions(self, spec_str, is_external, expected):
assert s.external == is_external assert s.external == is_external
assert s.satisfies(expected) assert s.satisfies(expected)
@pytest.mark.skipif(sys.platform == "win32",
reason='Not supported on Windows (yet)')
@pytest.mark.regression('20292') @pytest.mark.regression('20292')
@pytest.mark.parametrize('context', [ @pytest.mark.parametrize('context', [
{'add_variant': True, 'delete_variant': False}, {'add_variant': True, 'delete_variant': False},

View file

@ -3,7 +3,9 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import stat import stat
import sys
import pytest import pytest
@ -70,6 +72,8 @@ def assert_variant_values(spec, **variants):
assert concrete.variants[variant].value == value assert concrete.variants[variant].value == value
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.usefixtures('concretize_scope', 'mock_packages') @pytest.mark.usefixtures('concretize_scope', 'mock_packages')
class TestConcretizePreferences(object): class TestConcretizePreferences(object):
@pytest.mark.parametrize('package_name,variant_value,expected_results', [ @pytest.mark.parametrize('package_name,variant_value,expected_results', [
@ -230,7 +234,7 @@ def test_external_mpi(self):
# ensure that once config is in place, external is used # ensure that once config is in place, external is used
spec = Spec('mpi') spec = Spec('mpi')
spec.concretize() spec.concretize()
assert spec['mpich'].external_path == '/dummy/path' assert spec['mpich'].external_path == os.sep + os.path.join('dummy', 'path')
def test_external_module(self, monkeypatch): def test_external_module(self, monkeypatch):
"""Test that packages can find externals specified by module """Test that packages can find externals specified by module

View file

@ -6,12 +6,13 @@
import collections import collections
import getpass import getpass
import os import os
import sys
import tempfile import tempfile
import pytest import pytest
from six import StringIO from six import StringIO
from llnl.util.filesystem import mkdirp, touch from llnl.util.filesystem import getuid, mkdirp, touch
import spack.config import spack.config
import spack.environment as ev import spack.environment as ev
@ -333,6 +334,8 @@ def __init__(self, path):
self.path = path self.path = path
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_substitute_config_variables(mock_low_high_config, monkeypatch): def test_substitute_config_variables(mock_low_high_config, monkeypatch):
prefix = spack.paths.prefix.lstrip('/') prefix = spack.paths.prefix.lstrip('/')
@ -436,6 +439,8 @@ def test_merge_with_defaults(mock_low_high_config, write_config_file):
assert cfg['baz']['version'] == ['c'] assert cfg['baz']['version'] == ['c']
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_substitute_user(mock_low_high_config): def test_substitute_user(mock_low_high_config):
user = getpass.getuser() user = getpass.getuser()
assert '/foo/bar/' + user + '/baz' == spack_path.canonicalize_path( assert '/foo/bar/' + user + '/baz' == spack_path.canonicalize_path(
@ -443,6 +448,17 @@ def test_substitute_user(mock_low_high_config):
) )
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_substitute_user_config(mock_low_high_config):
user_config_path = spack.paths.user_config_path
assert user_config_path + '/baz' == spack_path.canonicalize_path(
'$user_cache_path/baz'
)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_substitute_user_cache(mock_low_high_config): def test_substitute_user_cache(mock_low_high_config):
user_cache_path = spack.paths.user_cache_path user_cache_path = spack.paths.user_cache_path
assert user_cache_path + '/baz' == spack_path.canonicalize_path( assert user_cache_path + '/baz' == spack_path.canonicalize_path(
@ -450,6 +466,8 @@ def test_substitute_user_cache(mock_low_high_config):
) )
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_substitute_tempdir(mock_low_high_config): def test_substitute_tempdir(mock_low_high_config):
tempdir = tempfile.gettempdir() tempdir = tempfile.gettempdir()
assert tempdir == spack_path.canonicalize_path('$tempdir') assert tempdir == spack_path.canonicalize_path('$tempdir')
@ -466,6 +484,8 @@ def test_substitute_tempdir(mock_low_high_config):
'/path', os.path.sep.join(reps))[:MAX_PADDED_LEN] '/path', os.path.sep.join(reps))[:MAX_PADDED_LEN]
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize('config_settings,expected', [ @pytest.mark.parametrize('config_settings,expected', [
([], [None, None, None]), ([], [None, None, None]),
([['config:install_tree:root', '/path']], ['/path', None, None]), ([['config:install_tree:root', '/path']], ['/path', None, None]),
@ -816,7 +836,9 @@ def test_bad_config_section(mock_low_high_config):
spack.config.get('foobar') spack.config.get('foobar')
@pytest.mark.skipif(os.getuid() == 0, reason='user is root') @pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.skipif(getuid() == 0, reason='user is root')
def test_bad_command_line_scopes(tmpdir, mock_low_high_config): def test_bad_command_line_scopes(tmpdir, mock_low_high_config):
cfg = spack.config.Configuration() cfg = spack.config.Configuration()

View file

@ -2,12 +2,16 @@
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest import pytest
import spack.spec import spack.spec
import spack.store import spack.store
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize('hash_length', [1, 2, 3, 4, 5, 9]) @pytest.mark.parametrize('hash_length', [1, 2, 3, 4, 5, 9])
@pytest.mark.usefixtures('mock_packages') @pytest.mark.usefixtures('mock_packages')
def test_set_install_hash_length(hash_length, mutable_config, tmpdir): def test_set_install_hash_length(hash_length, mutable_config, tmpdir):
@ -24,7 +28,9 @@ def test_set_install_hash_length(hash_length, mutable_config, tmpdir):
assert len(hash_str) == hash_length assert len(hash_str) == hash_length
@pytest.mark.usefixtures('mock_packages') @pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.use_fixtures('mock_packages')
def test_set_install_hash_length_upper_case(mutable_config, tmpdir): def test_set_install_hash_length_upper_case(mutable_config, tmpdir):
mutable_config.set('config:install_hash_length', 5) mutable_config.set('config:install_hash_length', 5)
mutable_config.set( mutable_config.set(

View file

@ -13,6 +13,7 @@
import os.path import os.path
import re import re
import shutil import shutil
import sys
import tempfile import tempfile
import xml.etree.ElementTree import xml.etree.ElementTree
from typing import Dict # novm from typing import Dict # novm
@ -375,7 +376,7 @@ def check_for_leftover_stage_files(request, mock_stage, ignore_stage_files):
stage_files = os.listdir(stage_path) stage_files = os.listdir(stage_path)
files_in_stage = set(stage_files) - ignore_stage_files files_in_stage = set(stage_files) - ignore_stage_files
except OSError as err: except OSError as err:
if err.errno == errno.ENOENT: if err.errno == errno.ENOENT or err.errno == errno.EINVAL:
pass pass
else: else:
raise raise
@ -591,7 +592,11 @@ def configuration_dir(tmpdir_factory, linux_os):
tmpdir.ensure('user', dir=True) tmpdir.ensure('user', dir=True)
# Slightly modify config.yaml and compilers.yaml # Slightly modify config.yaml and compilers.yaml
solver = os.environ.get('SPACK_TEST_SOLVER', 'clingo') if os.name == 'nt':
solver = 'original'
else:
solver = os.environ.get('SPACK_TEST_SOLVER', 'clingo')
config_yaml = test_config.join('config.yaml') config_yaml = test_config.join('config.yaml')
modules_root = tmpdir_factory.mktemp('share') modules_root = tmpdir_factory.mktemp('share')
tcl_root = modules_root.ensure('modules', dir=True) tcl_root = modules_root.ensure('modules', dir=True)
@ -1032,10 +1037,14 @@ def mock_archive(request, tmpdir_factory):
['url', 'path', 'archive_file', ['url', 'path', 'archive_file',
'expanded_archive_basedir']) 'expanded_archive_basedir'])
archive_file = str(tmpdir.join(archive_name)) archive_file = str(tmpdir.join(archive_name))
if sys.platform == 'win32':
url = ('file:///' + archive_file)
else:
url = ('file://' + archive_file)
# Return the url # Return the url
yield Archive( yield Archive(
url=('file://' + archive_file), url=url,
archive_file=archive_file, archive_file=archive_file,
path=str(repodir), path=str(repodir),
expanded_archive_basedir=spack.stage._source_path_subdir) expanded_archive_basedir=spack.stage._source_path_subdir)

View file

@ -8,6 +8,7 @@
import spack.container.images import spack.container.images
import spack.main import spack.main
import spack.platforms
containerize = spack.main.SpackCommand('containerize') containerize = spack.main.SpackCommand('containerize')
@ -26,6 +27,8 @@ def test_listing_possible_os():
assert expected_os in output assert expected_os in output
@pytest.mark.skipif(str(spack.platforms.host()) == "windows",
reason="test unsupported on Windows")
@pytest.mark.maybeslow @pytest.mark.maybeslow
@pytest.mark.requires_executables('git') @pytest.mark.requires_executables('git')
def test_bootstrap_phase(minimal_configuration, config_dumper, capsys): def test_bootstrap_phase(minimal_configuration, config_dumper, capsys):

View file

@ -12,6 +12,7 @@
import json import json
import os import os
import shutil import shutil
import sys
import pytest import pytest
@ -61,6 +62,8 @@ def upstream_and_downstream_db(tmpdir_factory, gen_mock_layout):
downstream_db, downstream_layout downstream_db, downstream_layout
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.usefixtures('config') @pytest.mark.usefixtures('config')
def test_installed_upstream(upstream_and_downstream_db): def test_installed_upstream(upstream_and_downstream_db):
upstream_write_db, upstream_db, upstream_layout,\ upstream_write_db, upstream_db, upstream_layout,\
@ -104,6 +107,8 @@ def test_installed_upstream(upstream_and_downstream_db):
downstream_db._check_ref_counts() downstream_db._check_ref_counts()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.usefixtures('config') @pytest.mark.usefixtures('config')
def test_removed_upstream_dep(upstream_and_downstream_db): def test_removed_upstream_dep(upstream_and_downstream_db):
upstream_write_db, upstream_db, upstream_layout,\ upstream_write_db, upstream_db, upstream_layout,\
@ -135,6 +140,8 @@ def test_removed_upstream_dep(upstream_and_downstream_db):
new_downstream._read() new_downstream._read()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.usefixtures('config') @pytest.mark.usefixtures('config')
def test_add_to_upstream_after_downstream(upstream_and_downstream_db): def test_add_to_upstream_after_downstream(upstream_and_downstream_db):
"""An upstream DB can add a package after it is installed in the downstream """An upstream DB can add a package after it is installed in the downstream
@ -172,6 +179,8 @@ def test_add_to_upstream_after_downstream(upstream_and_downstream_db):
spack.store.db = orig_db spack.store.db = orig_db
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.usefixtures('config', 'temporary_store') @pytest.mark.usefixtures('config', 'temporary_store')
def test_cannot_write_upstream(tmpdir_factory, gen_mock_layout): def test_cannot_write_upstream(tmpdir_factory, gen_mock_layout):
roots = [str(tmpdir_factory.mktemp(x)) for x in ['a', 'b']] roots = [str(tmpdir_factory.mktemp(x)) for x in ['a', 'b']]
@ -197,6 +206,8 @@ def test_cannot_write_upstream(tmpdir_factory, gen_mock_layout):
upstream_dbs[0].add(spec, layouts[1]) upstream_dbs[0].add(spec, layouts[1])
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.usefixtures('config', 'temporary_store') @pytest.mark.usefixtures('config', 'temporary_store')
def test_recursive_upstream_dbs(tmpdir_factory, gen_mock_layout): def test_recursive_upstream_dbs(tmpdir_factory, gen_mock_layout):
roots = [str(tmpdir_factory.mktemp(x)) for x in ['a', 'b', 'c']] roots = [str(tmpdir_factory.mktemp(x)) for x in ['a', 'b', 'c']]
@ -371,6 +382,8 @@ def _mock_remove(spec):
spec.package.do_uninstall(spec) spec.package.do_uninstall(spec)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_default_queries(database): def test_default_queries(database):
# Testing a package whose name *doesn't* start with 'lib' # Testing a package whose name *doesn't* start with 'lib'
# to ensure the library has 'lib' prepended to the name # to ensure the library has 'lib' prepended to the name
@ -411,6 +424,8 @@ def test_default_queries(database):
assert os.path.exists(command.path) assert os.path.exists(command.path)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_005_db_exists(database): def test_005_db_exists(database):
"""Make sure db cache file exists after creating.""" """Make sure db cache file exists after creating."""
index_file = os.path.join(database.root, '.spack-db', 'index.json') index_file = os.path.join(database.root, '.spack-db', 'index.json')
@ -423,6 +438,8 @@ def test_005_db_exists(database):
validate(index_object, schema) validate(index_object, schema)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_010_all_install_sanity(database): def test_010_all_install_sanity(database):
"""Ensure that the install layout reflects what we think it does.""" """Ensure that the install layout reflects what we think it does."""
all_specs = spack.store.layout.all_specs() all_specs = spack.store.layout.all_specs()
@ -458,6 +475,8 @@ def test_010_all_install_sanity(database):
) == 1 ) == 1
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_015_write_and_read(mutable_database): def test_015_write_and_read(mutable_database):
# write and read DB # write and read DB
with spack.store.db.write_transaction(): with spack.store.db.write_transaction():
@ -472,6 +491,8 @@ def test_015_write_and_read(mutable_database):
assert new_rec.installed == rec.installed assert new_rec.installed == rec.installed
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_017_write_and_read_without_uuid(mutable_database, monkeypatch): def test_017_write_and_read_without_uuid(mutable_database, monkeypatch):
monkeypatch.setattr(spack.database, '_use_uuid', False) monkeypatch.setattr(spack.database, '_use_uuid', False)
# write and read DB # write and read DB
@ -487,17 +508,23 @@ def test_017_write_and_read_without_uuid(mutable_database, monkeypatch):
assert new_rec.installed == rec.installed assert new_rec.installed == rec.installed
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_020_db_sanity(database): def test_020_db_sanity(database):
"""Make sure query() returns what's actually in the db.""" """Make sure query() returns what's actually in the db."""
_check_db_sanity(database) _check_db_sanity(database)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_025_reindex(mutable_database): def test_025_reindex(mutable_database):
"""Make sure reindex works and ref counts are valid.""" """Make sure reindex works and ref counts are valid."""
spack.store.store.reindex() spack.store.store.reindex()
_check_db_sanity(mutable_database) _check_db_sanity(mutable_database)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_026_reindex_after_deprecate(mutable_database): def test_026_reindex_after_deprecate(mutable_database):
"""Make sure reindex works and ref counts are valid after deprecation.""" """Make sure reindex works and ref counts are valid after deprecation."""
mpich = mutable_database.query_one('mpich') mpich = mutable_database.query_one('mpich')
@ -519,6 +546,8 @@ def __call__(self):
_mock_remove('mpileaks ^zmpi') _mock_remove('mpileaks ^zmpi')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_030_db_sanity_from_another_process(mutable_database): def test_030_db_sanity_from_another_process(mutable_database):
spack_process = spack.subprocess_context.SpackTestProcess(ReadModify()) spack_process = spack.subprocess_context.SpackTestProcess(ReadModify())
p = spack_process.create() p = spack_process.create()
@ -530,11 +559,15 @@ def test_030_db_sanity_from_another_process(mutable_database):
assert len(mutable_database.query('mpileaks ^zmpi')) == 0 assert len(mutable_database.query('mpileaks ^zmpi')) == 0
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_040_ref_counts(database): def test_040_ref_counts(database):
"""Ensure that we got ref counts right when we read the DB.""" """Ensure that we got ref counts right when we read the DB."""
database._check_ref_counts() database._check_ref_counts()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_041_ref_counts_deprecate(mutable_database): def test_041_ref_counts_deprecate(mutable_database):
"""Ensure that we have appropriate ref counts after deprecating""" """Ensure that we have appropriate ref counts after deprecating"""
mpich = mutable_database.query_one('mpich') mpich = mutable_database.query_one('mpich')
@ -544,6 +577,8 @@ def test_041_ref_counts_deprecate(mutable_database):
mutable_database._check_ref_counts() mutable_database._check_ref_counts()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_050_basic_query(database): def test_050_basic_query(database):
"""Ensure querying database is consistent with what is installed.""" """Ensure querying database is consistent with what is installed."""
# query everything # query everything
@ -580,14 +615,20 @@ def test_050_basic_query(database):
assert len(database.query(end_date=datetime.datetime.max)) == total_specs assert len(database.query(end_date=datetime.datetime.max)) == total_specs
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_060_remove_and_add_root_package(mutable_database): def test_060_remove_and_add_root_package(mutable_database):
_check_remove_and_add_package(mutable_database, 'mpileaks ^mpich') _check_remove_and_add_package(mutable_database, 'mpileaks ^mpich')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_070_remove_and_add_dependency_package(mutable_database): def test_070_remove_and_add_dependency_package(mutable_database):
_check_remove_and_add_package(mutable_database, 'dyninst') _check_remove_and_add_package(mutable_database, 'dyninst')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_080_root_ref_counts(mutable_database): def test_080_root_ref_counts(mutable_database):
rec = mutable_database.get_record('mpileaks ^mpich') rec = mutable_database.get_record('mpileaks ^mpich')
@ -612,6 +653,8 @@ def test_080_root_ref_counts(mutable_database):
assert mutable_database.get_record('mpich').ref_count == 2 assert mutable_database.get_record('mpich').ref_count == 2
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_090_non_root_ref_counts(mutable_database): def test_090_non_root_ref_counts(mutable_database):
mutable_database.get_record('mpileaks ^mpich') mutable_database.get_record('mpileaks ^mpich')
mutable_database.get_record('callpath ^mpich') mutable_database.get_record('callpath ^mpich')
@ -641,6 +684,8 @@ def test_090_non_root_ref_counts(mutable_database):
assert mpich_rec.ref_count == 0 assert mpich_rec.ref_count == 0
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_100_no_write_with_exception_on_remove(database): def test_100_no_write_with_exception_on_remove(database):
def fail_while_writing(): def fail_while_writing():
with database.write_transaction(): with database.write_transaction():
@ -658,6 +703,8 @@ def fail_while_writing():
assert len(database.query('mpileaks ^zmpi', installed=any)) == 1 assert len(database.query('mpileaks ^zmpi', installed=any)) == 1
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_110_no_write_with_exception_on_install(database): def test_110_no_write_with_exception_on_install(database):
def fail_while_writing(): def fail_while_writing():
with database.write_transaction(): with database.write_transaction():
@ -675,6 +722,8 @@ def fail_while_writing():
assert database.query('cmake', installed=any) == [] assert database.query('cmake', installed=any) == []
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_115_reindex_with_packages_not_in_repo(mutable_database): def test_115_reindex_with_packages_not_in_repo(mutable_database):
# Dont add any package definitions to this repository, the idea is that # Dont add any package definitions to this repository, the idea is that
# packages should not have to be defined in the repository once they # packages should not have to be defined in the repository once they
@ -684,6 +733,8 @@ def test_115_reindex_with_packages_not_in_repo(mutable_database):
_check_db_sanity(mutable_database) _check_db_sanity(mutable_database)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_external_entries_in_db(mutable_database): def test_external_entries_in_db(mutable_database):
rec = mutable_database.get_record('mpileaks ^zmpi') rec = mutable_database.get_record('mpileaks ^zmpi')
assert rec.spec.external_path is None assert rec.spec.external_path is None
@ -701,6 +752,8 @@ def test_external_entries_in_db(mutable_database):
assert rec.explicit is True assert rec.explicit is True
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.regression('8036') @pytest.mark.regression('8036')
def test_regression_issue_8036(mutable_database, usr_folder_exists): def test_regression_issue_8036(mutable_database, usr_folder_exists):
# The test ensures that the external package prefix is treated as # The test ensures that the external package prefix is treated as
@ -716,6 +769,8 @@ def test_regression_issue_8036(mutable_database, usr_folder_exists):
assert s.package.installed assert s.package.installed
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.regression('11118') @pytest.mark.regression('11118')
def test_old_external_entries_prefix(mutable_database): def test_old_external_entries_prefix(mutable_database):
with open(spack.store.db._index_path, 'r') as f: with open(spack.store.db._index_path, 'r') as f:
@ -741,6 +796,8 @@ def test_old_external_entries_prefix(mutable_database):
assert record.spec.prefix == record.spec.external_path assert record.spec.prefix == record.spec.external_path
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_uninstall_by_spec(mutable_database): def test_uninstall_by_spec(mutable_database):
with mutable_database.write_transaction(): with mutable_database.write_transaction():
for spec in mutable_database.query(): for spec in mutable_database.query():
@ -751,6 +808,8 @@ def test_uninstall_by_spec(mutable_database):
assert len(mutable_database.query()) == 0 assert len(mutable_database.query()) == 0
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_query_unused_specs(mutable_database): def test_query_unused_specs(mutable_database):
# This spec installs a fake cmake as a build only dependency # This spec installs a fake cmake as a build only dependency
s = spack.spec.Spec('simple-inheritance') s = spack.spec.Spec('simple-inheritance')
@ -762,6 +821,8 @@ def test_query_unused_specs(mutable_database):
assert unused[0].name == 'cmake' assert unused[0].name == 'cmake'
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.regression('10019') @pytest.mark.regression('10019')
def test_query_spec_with_conditional_dependency(mutable_database): def test_query_spec_with_conditional_dependency(mutable_database):
# The issue is triggered by having dependencies that are # The issue is triggered by having dependencies that are
@ -774,6 +835,8 @@ def test_query_spec_with_conditional_dependency(mutable_database):
assert not results assert not results
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.regression('10019') @pytest.mark.regression('10019')
def test_query_spec_with_non_conditional_virtual_dependency(database): def test_query_spec_with_non_conditional_virtual_dependency(database):
# Ensure the same issue doesn't come up for virtual # Ensure the same issue doesn't come up for virtual
@ -782,6 +845,8 @@ def test_query_spec_with_non_conditional_virtual_dependency(database):
assert len(results) == 1 assert len(results) == 1
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_failed_spec_path_error(database): def test_failed_spec_path_error(database):
"""Ensure spec not concrete check is covered.""" """Ensure spec not concrete check is covered."""
s = spack.spec.Spec('a') s = spack.spec.Spec('a')
@ -789,6 +854,8 @@ def test_failed_spec_path_error(database):
spack.store.db._failed_spec_path(s) spack.store.db._failed_spec_path(s)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.db @pytest.mark.db
def test_clear_failure_keep(mutable_database, monkeypatch, capfd): def test_clear_failure_keep(mutable_database, monkeypatch, capfd):
"""Add test coverage for clear_failure operation when to be retained.""" """Add test coverage for clear_failure operation when to be retained."""
@ -804,6 +871,8 @@ def _is(db, spec):
assert 'Retaining failure marking' in out assert 'Retaining failure marking' in out
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.db @pytest.mark.db
def test_clear_failure_forced(mutable_database, monkeypatch, capfd): def test_clear_failure_forced(mutable_database, monkeypatch, capfd):
"""Add test coverage for clear_failure operation when force.""" """Add test coverage for clear_failure operation when force."""
@ -822,6 +891,8 @@ def _is(db, spec):
assert 'Unable to remove failure marking' in out assert 'Unable to remove failure marking' in out
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.db @pytest.mark.db
def test_mark_failed(mutable_database, monkeypatch, tmpdir, capsys): def test_mark_failed(mutable_database, monkeypatch, tmpdir, capsys):
"""Add coverage to mark_failed.""" """Add coverage to mark_failed."""
@ -843,6 +914,8 @@ def _raise_exc(lock):
del spack.store.db._prefix_failures[s.prefix] del spack.store.db._prefix_failures[s.prefix]
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.db @pytest.mark.db
def test_prefix_failed(mutable_database, monkeypatch): def test_prefix_failed(mutable_database, monkeypatch):
"""Add coverage to prefix_failed operation.""" """Add coverage to prefix_failed operation."""
@ -867,6 +940,8 @@ def _is(db, spec):
assert spack.store.db.prefix_failed(s) assert spack.store.db.prefix_failed(s)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_prefix_read_lock_error(mutable_database, monkeypatch): def test_prefix_read_lock_error(mutable_database, monkeypatch):
"""Cover the prefix read lock exception.""" """Cover the prefix read lock exception."""
def _raise(db, spec): def _raise(db, spec):
@ -882,6 +957,8 @@ def _raise(db, spec):
assert False assert False
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_prefix_write_lock_error(mutable_database, monkeypatch): def test_prefix_write_lock_error(mutable_database, monkeypatch):
"""Cover the prefix write lock exception.""" """Cover the prefix write lock exception."""
def _raise(db, spec): def _raise(db, spec):

View file

@ -8,6 +8,7 @@
""" """
import os import os
import os.path import os.path
import sys
import pytest import pytest
@ -23,6 +24,8 @@
max_packages = 10 max_packages = 10
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_yaml_directory_layout_parameters(tmpdir, config): def test_yaml_directory_layout_parameters(tmpdir, config):
"""This tests the various parameters that can be used to configure """This tests the various parameters that can be used to configure
the install location """ the install location """
@ -78,6 +81,8 @@ def test_yaml_directory_layout_parameters(tmpdir, config):
projections=projections_package7) projections=projections_package7)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_read_and_write_spec(temporary_store, config, mock_packages): def test_read_and_write_spec(temporary_store, config, mock_packages):
"""This goes through each package in spack and creates a directory for """This goes through each package in spack and creates a directory for
it. It then ensures that the spec for the directory's it. It then ensures that the spec for the directory's
@ -203,6 +208,8 @@ def test_handle_unknown_package(temporary_store, config, mock_packages):
assert spec.dag_hash() == spec_from_file.dag_hash() assert spec.dag_hash() == spec_from_file.dag_hash()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_find(temporary_store, config, mock_packages): def test_find(temporary_store, config, mock_packages):
"""Test that finding specs within an install layout works.""" """Test that finding specs within an install layout works."""
layout = temporary_store.layout layout = temporary_store.layout
@ -226,6 +233,8 @@ def test_find(temporary_store, config, mock_packages):
assert found_specs[name].eq_dag(spec) assert found_specs[name].eq_dag(spec)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_yaml_directory_layout_build_path(tmpdir, config): def test_yaml_directory_layout_build_path(tmpdir, config):
"""This tests build path method.""" """This tests build path method."""
spec = Spec('python') spec = Spec('python')

View file

@ -11,6 +11,8 @@
import spack.spec import spack.spec
@pytest.mark.skipif(str(spack.platforms.host()) == 'windows',
reason='Not supported on Windows (yet)')
def test_hash_change_no_rehash_concrete(tmpdir, mock_packages, config): def test_hash_change_no_rehash_concrete(tmpdir, mock_packages, config):
# create an environment # create an environment
env_path = tmpdir.mkdir('env_dir').strpath env_path = tmpdir.mkdir('env_dir').strpath

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os import os
import sys
import pytest import pytest
@ -162,6 +163,8 @@ def test_unset(env):
os.environ['UNSET_ME'] os.environ['UNSET_ME']
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_filter_system_paths(miscellaneous_paths): def test_filter_system_paths(miscellaneous_paths):
"""Tests that the filtering of system paths works as expected.""" """Tests that the filtering of system paths works as expected."""
filtered = filter_system_paths(miscellaneous_paths) filtered = filter_system_paths(miscellaneous_paths)
@ -175,6 +178,8 @@ def test_filter_system_paths(miscellaneous_paths):
assert filtered == expected assert filtered == expected
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_set_path(env): def test_set_path(env):
"""Tests setting paths in an environment variable.""" """Tests setting paths in an environment variable."""
@ -190,6 +195,8 @@ def test_set_path(env):
assert 'foo;bar;baz' == os.environ['B'] assert 'foo;bar;baz' == os.environ['B']
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_path_manipulation(env): def test_path_manipulation(env):
"""Tests manipulating list of paths in the environment.""" """Tests manipulating list of paths in the environment."""
@ -254,6 +261,8 @@ def test_extend(env):
assert x is y assert x is y
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.usefixtures('prepare_environment_for_tests') @pytest.mark.usefixtures('prepare_environment_for_tests')
def test_source_files(files_to_be_sourced): def test_source_files(files_to_be_sourced):
"""Tests the construction of a list of environment modifications that are """Tests the construction of a list of environment modifications that are
@ -321,6 +330,8 @@ def test_preserve_environment(prepare_environment_for_tests):
assert os.environ['PATH_LIST'] == '/path/second:/path/third' assert os.environ['PATH_LIST'] == '/path/second:/path/third'
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize('files,expected,deleted', [ @pytest.mark.parametrize('files,expected,deleted', [
# Sets two variables # Sets two variables
((os.path.join(datadir, 'sourceme_first.sh'),), ((os.path.join(datadir, 'sourceme_first.sh'),),
@ -406,6 +417,8 @@ def test_sanitize_regex(env, blacklist, whitelist, expected, deleted):
assert all(x not in after for x in deleted) assert all(x not in after for x in deleted)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.regression('12085') @pytest.mark.regression('12085')
@pytest.mark.parametrize('before,after,search_list', [ @pytest.mark.parametrize('before,after,search_list', [
# Set environment variables # Set environment variables
@ -445,6 +458,8 @@ def test_from_environment_diff(before, after, search_list):
assert item in mod assert item in mod
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.regression('15775') @pytest.mark.regression('15775')
def test_blacklist_lmod_variables(): def test_blacklist_lmod_variables():
# Construct the list of environment modifications # Construct the list of environment modifications

View file

@ -6,6 +6,7 @@
import copy import copy
import os import os
import shutil import shutil
import sys
import pytest import pytest
@ -82,6 +83,8 @@ def test_bad_git(tmpdir, mock_bad_git):
fetcher.fetch() fetcher.fetch()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize("type_of_test", ['master', 'branch', 'tag', 'commit']) @pytest.mark.parametrize("type_of_test", ['master', 'branch', 'tag', 'commit'])
@pytest.mark.parametrize("secure", [True, False]) @pytest.mark.parametrize("secure", [True, False])
def test_fetch(type_of_test, def test_fetch(type_of_test,
@ -137,6 +140,8 @@ def test_fetch(type_of_test,
assert h('HEAD') == h(t.revision) assert h('HEAD') == h(t.revision)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize("type_of_test", ['branch', 'commit']) @pytest.mark.parametrize("type_of_test", ['branch', 'commit'])
def test_debug_fetch( def test_debug_fetch(
mock_packages, type_of_test, mock_git_repository, config, monkeypatch mock_packages, type_of_test, mock_git_repository, config, monkeypatch
@ -177,6 +182,8 @@ def test_needs_stage():
fetcher.fetch() fetcher.fetch()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize("get_full_repo", [True, False]) @pytest.mark.parametrize("get_full_repo", [True, False])
def test_get_full_repo(get_full_repo, git_version, mock_git_repository, def test_get_full_repo(get_full_repo, git_version, mock_git_repository,
config, mutable_mock_repo, monkeypatch): config, mutable_mock_repo, monkeypatch):
@ -222,6 +229,8 @@ def test_get_full_repo(get_full_repo, git_version, mock_git_repository,
assert(ncommits == 1) assert(ncommits == 1)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
@pytest.mark.parametrize("submodules", [True, False]) @pytest.mark.parametrize("submodules", [True, False])
def test_gitsubmodule(submodules, mock_git_repository, config, def test_gitsubmodule(submodules, mock_git_repository, config,
@ -251,6 +260,8 @@ def test_gitsubmodule(submodules, mock_git_repository, config,
assert not os.path.isfile(file_path) assert not os.path.isfile(file_path)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_gitsubmodules_delete( def test_gitsubmodules_delete(
mock_git_repository, config, mutable_mock_repo, monkeypatch mock_git_repository, config, mutable_mock_repo, monkeypatch

View file

@ -48,6 +48,8 @@ def test_static_graph_mpileaks(config, mock_packages):
assert ' "dyninst" -> "libelf"\n' in dot assert ' "dyninst" -> "libelf"\n' in dot
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_dynamic_dot_graph_mpileaks(mock_packages, config): def test_dynamic_dot_graph_mpileaks(mock_packages, config):
"""Test dynamically graphing the mpileaks package.""" """Test dynamically graphing the mpileaks package."""
s = spack.spec.Spec('mpileaks').concretized() s = spack.spec.Spec('mpileaks').concretized()

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os import os
import sys
import pytest import pytest
@ -21,6 +22,8 @@
not which('hg'), reason='requires mercurial to be installed') not which('hg'), reason='requires mercurial to be installed')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize("type_of_test", ['default', 'rev0']) @pytest.mark.parametrize("type_of_test", ['default', 'rev0'])
@pytest.mark.parametrize("secure", [True, False]) @pytest.mark.parametrize("secure", [True, False])
def test_fetch( def test_fetch(

View file

@ -5,6 +5,7 @@
import os import os
import shutil import shutil
import sys
import pytest import pytest
@ -31,6 +32,8 @@ def find_nothing(*args):
'Repo package access is disabled for test') 'Repo package access is disabled for test')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_install_and_uninstall(install_mockery, mock_fetch, monkeypatch): def test_install_and_uninstall(install_mockery, mock_fetch, monkeypatch):
# Get a basic concrete spec for the trivial install package. # Get a basic concrete spec for the trivial install package.
spec = Spec('trivial-install-test-package') spec = Spec('trivial-install-test-package')
@ -97,6 +100,8 @@ def __getattr__(self, attr):
return getattr(self.wrapped_stage, attr) return getattr(self.wrapped_stage, attr)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_partial_install_delete_prefix_and_stage(install_mockery, mock_fetch): def test_partial_install_delete_prefix_and_stage(install_mockery, mock_fetch):
spec = Spec('canfail').concretized() spec = Spec('canfail').concretized()
pkg = spack.repo.get(spec) pkg = spack.repo.get(spec)
@ -126,6 +131,8 @@ def test_partial_install_delete_prefix_and_stage(install_mockery, mock_fetch):
pkg.remove_prefix = instance_rm_prefix pkg.remove_prefix = instance_rm_prefix
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_failing_overwrite_install_should_keep_previous_installation( def test_failing_overwrite_install_should_keep_previous_installation(
mock_fetch, install_mockery mock_fetch, install_mockery
@ -151,6 +158,8 @@ def test_failing_overwrite_install_should_keep_previous_installation(
assert os.path.exists(spec.prefix) assert os.path.exists(spec.prefix)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_dont_add_patches_to_installed_package( def test_dont_add_patches_to_installed_package(
install_mockery, mock_fetch, monkeypatch install_mockery, mock_fetch, monkeypatch
): ):
@ -171,6 +180,8 @@ def test_dont_add_patches_to_installed_package(
assert dependent['dependency-install'] == dependency assert dependent['dependency-install'] == dependency
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_installed_dependency_request_conflicts( def test_installed_dependency_request_conflicts(
install_mockery, mock_fetch, mutable_mock_repo): install_mockery, mock_fetch, mutable_mock_repo):
dependency = Spec('dependency-install') dependency = Spec('dependency-install')
@ -184,6 +195,8 @@ def test_installed_dependency_request_conflicts(
dependent.concretize() dependent.concretize()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_install_dependency_symlinks_pkg( def test_install_dependency_symlinks_pkg(
install_mockery, mock_fetch, mutable_mock_repo): install_mockery, mock_fetch, mutable_mock_repo):
"""Test dependency flattening/symlinks mock package.""" """Test dependency flattening/symlinks mock package."""
@ -197,6 +210,8 @@ def test_install_dependency_symlinks_pkg(
assert os.path.isdir(dependency_dir) assert os.path.isdir(dependency_dir)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_install_times( def test_install_times(
install_mockery, mock_fetch, mutable_mock_repo): install_mockery, mock_fetch, mutable_mock_repo):
"""Test install times added.""" """Test install times added."""
@ -223,6 +238,8 @@ def test_install_times(
assert abs(total - times['total']['seconds']) < 5 assert abs(total - times['total']['seconds']) < 5
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_flatten_deps( def test_flatten_deps(
install_mockery, mock_fetch, mutable_mock_repo): install_mockery, mock_fetch, mutable_mock_repo):
"""Explicitly test the flattening code for coverage purposes.""" """Explicitly test the flattening code for coverage purposes."""
@ -272,6 +289,8 @@ def _install_upstream(*specs):
return _install_upstream return _install_upstream
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_installed_upstream_external(install_upstream, mock_fetch): def test_installed_upstream_external(install_upstream, mock_fetch):
"""Check that when a dependency package is recorded as installed in """Check that when a dependency package is recorded as installed in
an upstream database that it is not reinstalled. an upstream database that it is not reinstalled.
@ -291,6 +310,8 @@ def test_installed_upstream_external(install_upstream, mock_fetch):
assert os.path.exists(dependent.prefix) assert os.path.exists(dependent.prefix)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_installed_upstream(install_upstream, mock_fetch): def test_installed_upstream(install_upstream, mock_fetch):
"""Check that when a dependency package is recorded as installed in """Check that when a dependency package is recorded as installed in
an upstream database that it is not reinstalled. an upstream database that it is not reinstalled.
@ -311,6 +332,8 @@ def test_installed_upstream(install_upstream, mock_fetch):
assert os.path.exists(dependent.prefix) assert os.path.exists(dependent.prefix)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_partial_install_keep_prefix(install_mockery, mock_fetch, monkeypatch): def test_partial_install_keep_prefix(install_mockery, mock_fetch, monkeypatch):
spec = Spec('canfail').concretized() spec = Spec('canfail').concretized()
@ -337,6 +360,8 @@ def test_partial_install_keep_prefix(install_mockery, mock_fetch, monkeypatch):
assert not pkg.stage.test_destroyed assert not pkg.stage.test_destroyed
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_second_install_no_overwrite_first(install_mockery, mock_fetch, monkeypatch): def test_second_install_no_overwrite_first(install_mockery, mock_fetch, monkeypatch):
spec = Spec('canfail').concretized() spec = Spec('canfail').concretized()
pkg = spack.repo.get(spec) pkg = spack.repo.get(spec)
@ -351,6 +376,8 @@ def test_second_install_no_overwrite_first(install_mockery, mock_fetch, monkeypa
pkg.do_install() pkg.do_install()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_install_prefix_collision_fails(config, mock_fetch, mock_packages, tmpdir): def test_install_prefix_collision_fails(config, mock_fetch, mock_packages, tmpdir):
""" """
Test that different specs with coinciding install prefixes will fail Test that different specs with coinciding install prefixes will fail
@ -368,12 +395,16 @@ def test_install_prefix_collision_fails(config, mock_fetch, mock_packages, tmpdi
pkg_b.do_install() pkg_b.do_install()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Package ninja not found")
def test_store(install_mockery, mock_fetch): def test_store(install_mockery, mock_fetch):
spec = Spec('cmake-client').concretized() spec = Spec('cmake-client').concretized()
pkg = spec.package pkg = spec.package
pkg.do_install() pkg.do_install()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_failing_build(install_mockery, mock_fetch, capfd): def test_failing_build(install_mockery, mock_fetch, capfd):
spec = Spec('failing-build').concretized() spec = Spec('failing-build').concretized()
@ -388,6 +419,8 @@ class MockInstallError(spack.error.SpackError):
pass pass
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_uninstall_by_spec_errors(mutable_database): def test_uninstall_by_spec_errors(mutable_database):
"""Test exceptional cases with the uninstall command.""" """Test exceptional cases with the uninstall command."""
@ -403,6 +436,8 @@ def test_uninstall_by_spec_errors(mutable_database):
PackageBase.uninstall_by_spec(rec.spec) PackageBase.uninstall_by_spec(rec.spec)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.disable_clean_stage_check @pytest.mark.disable_clean_stage_check
def test_nosource_pkg_install( def test_nosource_pkg_install(
install_mockery, mock_fetch, mock_packages, capfd): install_mockery, mock_fetch, mock_packages, capfd):
@ -417,6 +452,8 @@ def test_nosource_pkg_install(
assert "Missing a source id for nosource" in out[1] assert "Missing a source id for nosource" in out[1]
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_nosource_pkg_install_post_install( def test_nosource_pkg_install_post_install(
install_mockery, mock_fetch, mock_packages): install_mockery, mock_fetch, mock_packages):
"""Test install phases with the nosource package with post-install.""" """Test install phases with the nosource package with post-install."""
@ -435,6 +472,8 @@ def test_nosource_pkg_install_post_install(
assert os.path.isfile(post_install_txt) assert os.path.isfile(post_install_txt)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_pkg_build_paths(install_mockery): def test_pkg_build_paths(install_mockery):
# Get a basic concrete spec for the trivial install package. # Get a basic concrete spec for the trivial install package.
spec = Spec('trivial-install-test-package').concretized() spec = Spec('trivial-install-test-package').concretized()
@ -468,6 +507,8 @@ def test_pkg_build_paths(install_mockery):
shutil.rmtree(log_dir) shutil.rmtree(log_dir)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_pkg_install_paths(install_mockery): def test_pkg_install_paths(install_mockery):
# Get a basic concrete spec for the trivial install package. # Get a basic concrete spec for the trivial install package.
spec = Spec('trivial-install-test-package').concretized() spec = Spec('trivial-install-test-package').concretized()
@ -504,6 +545,8 @@ def test_pkg_install_paths(install_mockery):
shutil.rmtree(log_dir) shutil.rmtree(log_dir)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_log_install_without_build_files(install_mockery): def test_log_install_without_build_files(install_mockery):
"""Test the installer log function when no build files are present.""" """Test the installer log function when no build files are present."""
# Get a basic concrete spec for the trivial install package. # Get a basic concrete spec for the trivial install package.
@ -514,6 +557,8 @@ def test_log_install_without_build_files(install_mockery):
spack.installer.log(spec.package) spack.installer.log(spec.package)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_log_install_with_build_files(install_mockery, monkeypatch): def test_log_install_with_build_files(install_mockery, monkeypatch):
"""Test the installer's log function when have build files.""" """Test the installer's log function when have build files."""
config_log = 'config.log' config_log = 'config.log'

View file

@ -5,6 +5,7 @@
import os import os
import shutil import shutil
import sys
import py import py
import pytest import pytest
@ -118,6 +119,8 @@ def test_hms(sec, result):
assert inst._hms(sec) == result assert inst._hms(sec) == result
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_get_dependent_ids(install_mockery, mock_packages): def test_get_dependent_ids(install_mockery, mock_packages):
# Concretize the parent package, which handle dependency too # Concretize the parent package, which handle dependency too
spec = spack.spec.Spec('a') spec = spack.spec.Spec('a')
@ -151,6 +154,8 @@ def test_install_msg(monkeypatch):
assert inst.install_msg(name, pid) == expected assert inst.install_msg(name, pid) == expected
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_install_from_cache_errors(install_mockery, capsys): def test_install_from_cache_errors(install_mockery, capsys):
"""Test to ensure cover _install_from_cache errors.""" """Test to ensure cover _install_from_cache errors."""
spec = spack.spec.Spec('trivial-install-test-package') spec = spack.spec.Spec('trivial-install-test-package')
@ -171,6 +176,8 @@ def test_install_from_cache_errors(install_mockery, capsys):
assert not spec.package.installed_from_binary_cache assert not spec.package.installed_from_binary_cache
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_install_from_cache_ok(install_mockery, monkeypatch): def test_install_from_cache_ok(install_mockery, monkeypatch):
"""Test to ensure cover _install_from_cache to the return.""" """Test to ensure cover _install_from_cache to the return."""
spec = spack.spec.Spec('trivial-install-test-package') spec = spack.spec.Spec('trivial-install-test-package')
@ -181,6 +188,8 @@ def test_install_from_cache_ok(install_mockery, monkeypatch):
assert inst._install_from_cache(spec.package, True, True, False) assert inst._install_from_cache(spec.package, True, True, False)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_process_external_package_module(install_mockery, monkeypatch, capfd): def test_process_external_package_module(install_mockery, monkeypatch, capfd):
"""Test to simply cover the external module message path.""" """Test to simply cover the external module message path."""
spec = spack.spec.Spec('trivial-install-test-package') spec = spack.spec.Spec('trivial-install-test-package')
@ -209,6 +218,8 @@ def test_process_binary_cache_tarball_none(install_mockery, monkeypatch,
assert 'exists in binary cache but' in capfd.readouterr()[0] assert 'exists in binary cache but' in capfd.readouterr()[0]
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_process_binary_cache_tarball_tar(install_mockery, monkeypatch, capfd): def test_process_binary_cache_tarball_tar(install_mockery, monkeypatch, capfd):
"""Tests of _process_binary_cache_tarball with a tar file.""" """Tests of _process_binary_cache_tarball with a tar file."""
def _spec(spec, preferred_mirrors=None): def _spec(spec, preferred_mirrors=None):
@ -229,6 +240,8 @@ def _spec(spec, preferred_mirrors=None):
assert 'from binary cache' in out assert 'from binary cache' in out
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_try_install_from_binary_cache(install_mockery, mock_packages, def test_try_install_from_binary_cache(install_mockery, mock_packages,
monkeypatch): monkeypatch):
"""Test return false when no match exists in the mirror""" """Test return false when no match exists in the mirror"""
@ -238,6 +251,8 @@ def test_try_install_from_binary_cache(install_mockery, mock_packages,
assert(not result) assert(not result)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_installer_repr(install_mockery): def test_installer_repr(install_mockery):
const_arg = installer_args(['trivial-install-test-package'], {}) const_arg = installer_args(['trivial-install-test-package'], {})
installer = create_installer(const_arg) installer = create_installer(const_arg)
@ -248,6 +263,8 @@ def test_installer_repr(install_mockery):
assert "failed=" in irep assert "failed=" in irep
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_installer_str(install_mockery): def test_installer_str(install_mockery):
const_arg = installer_args(['trivial-install-test-package'], {}) const_arg = installer_args(['trivial-install-test-package'], {})
installer = create_installer(const_arg) installer = create_installer(const_arg)
@ -281,6 +298,8 @@ def test_check_last_phase_error(install_mockery):
assert pkg.last_phase in err assert pkg.last_phase in err
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_installer_ensure_ready_errors(install_mockery): def test_installer_ensure_ready_errors(install_mockery):
const_arg = installer_args(['trivial-install-test-package'], {}) const_arg = installer_args(['trivial-install-test-package'], {})
installer = create_installer(const_arg) installer = create_installer(const_arg)
@ -310,6 +329,8 @@ def test_installer_ensure_ready_errors(install_mockery):
installer._ensure_install_ready(spec.package) installer._ensure_install_ready(spec.package)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_ensure_locked_err(install_mockery, monkeypatch, tmpdir, capsys): def test_ensure_locked_err(install_mockery, monkeypatch, tmpdir, capsys):
"""Test _ensure_locked when a non-lock exception is raised.""" """Test _ensure_locked when a non-lock exception is raised."""
mock_err_msg = 'Mock exception error' mock_err_msg = 'Mock exception error'
@ -331,6 +352,8 @@ def _raise(lock, timeout):
assert mock_err_msg in out assert mock_err_msg in out
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_ensure_locked_have(install_mockery, tmpdir, capsys): def test_ensure_locked_have(install_mockery, tmpdir, capsys):
"""Test _ensure_locked when already have lock.""" """Test _ensure_locked when already have lock."""
const_arg = installer_args(['trivial-install-test-package'], {}) const_arg = installer_args(['trivial-install-test-package'], {})
@ -367,6 +390,8 @@ def test_ensure_locked_have(install_mockery, tmpdir, capsys):
assert installer._ensure_locked(lock_type, spec.package) == tpl assert installer._ensure_locked(lock_type, spec.package) == tpl
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize('lock_type,reads,writes', [ @pytest.mark.parametrize('lock_type,reads,writes', [
('read', 1, 0), ('read', 1, 0),
('write', 0, 1)]) ('write', 0, 1)])
@ -384,6 +409,8 @@ def test_ensure_locked_new_lock(
assert lock._writes == writes assert lock._writes == writes
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_ensure_locked_new_warn(install_mockery, monkeypatch, tmpdir, capsys): def test_ensure_locked_new_warn(install_mockery, monkeypatch, tmpdir, capsys):
orig_pl = spack.database.Database.prefix_lock orig_pl = spack.database.Database.prefix_lock
@ -414,6 +441,8 @@ def test_package_id_err(install_mockery):
inst.package_id(pkg) inst.package_id(pkg)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_package_id_ok(install_mockery): def test_package_id_ok(install_mockery):
spec = spack.spec.Spec('trivial-install-test-package') spec = spack.spec.Spec('trivial-install-test-package')
spec.concretize() spec.concretize()
@ -422,6 +451,8 @@ def test_package_id_ok(install_mockery):
assert pkg.name in inst.package_id(pkg) assert pkg.name in inst.package_id(pkg)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_fake_install(install_mockery): def test_fake_install(install_mockery):
spec = spack.spec.Spec('trivial-install-test-package') spec = spack.spec.Spec('trivial-install-test-package')
spec.concretize() spec.concretize()
@ -432,6 +463,8 @@ def test_fake_install(install_mockery):
assert os.path.isdir(pkg.prefix.lib) assert os.path.isdir(pkg.prefix.lib)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_packages_needed_to_bootstrap_compiler_none(install_mockery): def test_packages_needed_to_bootstrap_compiler_none(install_mockery):
spec = spack.spec.Spec('trivial-install-test-package') spec = spack.spec.Spec('trivial-install-test-package')
spec.concretize() spec.concretize()
@ -442,6 +475,8 @@ def test_packages_needed_to_bootstrap_compiler_none(install_mockery):
assert not packages assert not packages
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_packages_needed_to_bootstrap_compiler_packages(install_mockery, def test_packages_needed_to_bootstrap_compiler_packages(install_mockery,
monkeypatch): monkeypatch):
spec = spack.spec.Spec('trivial-install-test-package') spec = spack.spec.Spec('trivial-install-test-package')
@ -461,6 +496,8 @@ def _conc_spec(compiler):
assert packages assert packages
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_dump_packages_deps_ok(install_mockery, tmpdir, mock_packages): def test_dump_packages_deps_ok(install_mockery, tmpdir, mock_packages):
"""Test happy path for dump_packages with dependencies.""" """Test happy path for dump_packages with dependencies."""
@ -473,6 +510,8 @@ def test_dump_packages_deps_ok(install_mockery, tmpdir, mock_packages):
assert os.path.isfile(dest_pkg) assert os.path.isfile(dest_pkg)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_dump_packages_deps_errs(install_mockery, tmpdir, monkeypatch, capsys): def test_dump_packages_deps_errs(install_mockery, tmpdir, monkeypatch, capsys):
"""Test error paths for dump_packages with dependencies.""" """Test error paths for dump_packages with dependencies."""
orig_bpp = spack.store.layout.build_packages_path orig_bpp = spack.store.layout.build_packages_path
@ -592,6 +631,8 @@ def test_combine_phase_logs(tmpdir):
assert "Output from %s\n" % log_file in out assert "Output from %s\n" % log_file in out
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_check_deps_status_install_failure(install_mockery, monkeypatch): def test_check_deps_status_install_failure(install_mockery, monkeypatch):
const_arg = installer_args(['a'], {}) const_arg = installer_args(['a'], {})
installer = create_installer(const_arg) installer = create_installer(const_arg)
@ -604,6 +645,8 @@ def test_check_deps_status_install_failure(install_mockery, monkeypatch):
installer._check_deps_status(request) installer._check_deps_status(request)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_check_deps_status_write_locked(install_mockery, monkeypatch): def test_check_deps_status_write_locked(install_mockery, monkeypatch):
const_arg = installer_args(['a'], {}) const_arg = installer_args(['a'], {})
installer = create_installer(const_arg) installer = create_installer(const_arg)
@ -616,6 +659,8 @@ def test_check_deps_status_write_locked(install_mockery, monkeypatch):
installer._check_deps_status(request) installer._check_deps_status(request)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_check_deps_status_external(install_mockery, monkeypatch): def test_check_deps_status_external(install_mockery, monkeypatch):
const_arg = installer_args(['a'], {}) const_arg = installer_args(['a'], {})
installer = create_installer(const_arg) installer = create_installer(const_arg)
@ -627,6 +672,8 @@ def test_check_deps_status_external(install_mockery, monkeypatch):
assert list(installer.installed)[0].startswith('b') assert list(installer.installed)[0].startswith('b')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_check_deps_status_upstream(install_mockery, monkeypatch): def test_check_deps_status_upstream(install_mockery, monkeypatch):
const_arg = installer_args(['a'], {}) const_arg = installer_args(['a'], {})
installer = create_installer(const_arg) installer = create_installer(const_arg)
@ -638,6 +685,8 @@ def test_check_deps_status_upstream(install_mockery, monkeypatch):
assert list(installer.installed)[0].startswith('b') assert list(installer.installed)[0].startswith('b')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_add_bootstrap_compilers(install_mockery, monkeypatch): def test_add_bootstrap_compilers(install_mockery, monkeypatch):
from collections import defaultdict from collections import defaultdict
@ -660,6 +709,8 @@ def _pkgs(compiler, architecture, pkgs):
assert task.compiler assert task.compiler
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_prepare_for_install_on_installed(install_mockery, monkeypatch): def test_prepare_for_install_on_installed(install_mockery, monkeypatch):
"""Test of _prepare_for_install's early return for installed task path.""" """Test of _prepare_for_install's early return for installed task path."""
const_arg = installer_args(['dependent-install'], {}) const_arg = installer_args(['dependent-install'], {})
@ -674,6 +725,8 @@ def test_prepare_for_install_on_installed(install_mockery, monkeypatch):
installer._prepare_for_install(task) installer._prepare_for_install(task)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_installer_init_requests(install_mockery): def test_installer_init_requests(install_mockery):
"""Test of installer initial requests.""" """Test of installer initial requests."""
spec_name = 'dependent-install' spec_name = 'dependent-install'
@ -687,6 +740,8 @@ def test_installer_init_requests(install_mockery):
assert request.pkg.name == spec_name assert request.pkg.name == spec_name
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_install_task_use_cache(install_mockery, monkeypatch): def test_install_task_use_cache(install_mockery, monkeypatch):
const_arg = installer_args(['trivial-install-test-package'], {}) const_arg = installer_args(['trivial-install-test-package'], {})
installer = create_installer(const_arg) installer = create_installer(const_arg)
@ -698,6 +753,8 @@ def test_install_task_use_cache(install_mockery, monkeypatch):
assert request.pkg_id in installer.installed assert request.pkg_id in installer.installed
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_install_task_add_compiler(install_mockery, monkeypatch, capfd): def test_install_task_add_compiler(install_mockery, monkeypatch, capfd):
config_msg = 'mock add_compilers_to_config' config_msg = 'mock add_compilers_to_config'
@ -722,6 +779,8 @@ def _add(_compilers):
assert config_msg in out assert config_msg in out
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_release_lock_write_n_exception(install_mockery, tmpdir, capsys): def test_release_lock_write_n_exception(install_mockery, tmpdir, capsys):
"""Test _release_lock for supposed write lock with exception.""" """Test _release_lock for supposed write lock with exception."""
const_arg = installer_args(['trivial-install-test-package'], {}) const_arg = installer_args(['trivial-install-test-package'], {})
@ -739,6 +798,8 @@ def test_release_lock_write_n_exception(install_mockery, tmpdir, capsys):
assert msg in out assert msg in out
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize('installed', [True, False]) @pytest.mark.parametrize('installed', [True, False])
def test_push_task_skip_processed(install_mockery, installed): def test_push_task_skip_processed(install_mockery, installed):
"""Test to ensure skip re-queueing a processed package.""" """Test to ensure skip re-queueing a processed package."""
@ -758,6 +819,8 @@ def test_push_task_skip_processed(install_mockery, installed):
assert len(list(installer.build_tasks)) == 0 assert len(list(installer.build_tasks)) == 0
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_requeue_task(install_mockery, capfd): def test_requeue_task(install_mockery, capfd):
"""Test to ensure cover _requeue_task.""" """Test to ensure cover _requeue_task."""
const_arg = installer_args(['a'], {}) const_arg = installer_args(['a'], {})
@ -782,6 +845,8 @@ def test_requeue_task(install_mockery, capfd):
assert ' in progress by another process' in out assert ' in progress by another process' in out
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_cleanup_all_tasks(install_mockery, monkeypatch): def test_cleanup_all_tasks(install_mockery, monkeypatch):
"""Test to ensure cover _cleanup_all_tasks.""" """Test to ensure cover _cleanup_all_tasks."""
def _mktask(pkg): def _mktask(pkg):
@ -806,6 +871,8 @@ def _rmtask(installer, pkg_id):
assert len(installer.build_tasks) == 1 assert len(installer.build_tasks) == 1
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_setup_install_dir_grp(install_mockery, monkeypatch, capfd): def test_setup_install_dir_grp(install_mockery, monkeypatch, capfd):
"""Test _setup_install_dir's group change.""" """Test _setup_install_dir's group change."""
mock_group = 'mockgroup' mock_group = 'mockgroup'
@ -836,6 +903,8 @@ def _chgrp(path, group):
assert expected_msg in out assert expected_msg in out
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_cleanup_failed_err(install_mockery, tmpdir, monkeypatch, capsys): def test_cleanup_failed_err(install_mockery, tmpdir, monkeypatch, capsys):
"""Test _cleanup_failed exception path.""" """Test _cleanup_failed exception path."""
msg = 'Fake release_write exception' msg = 'Fake release_write exception'
@ -858,6 +927,8 @@ def _raise_except(lock):
assert msg in out assert msg in out
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_update_failed_no_dependent_task(install_mockery): def test_update_failed_no_dependent_task(install_mockery):
"""Test _update_failed with missing dependent build tasks.""" """Test _update_failed with missing dependent build tasks."""
const_arg = installer_args(['dependent-install'], {}) const_arg = installer_args(['dependent-install'], {})
@ -870,6 +941,8 @@ def test_update_failed_no_dependent_task(install_mockery):
assert installer.failed[task.pkg_id] is None assert installer.failed[task.pkg_id] is None
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_install_uninstalled_deps(install_mockery, monkeypatch, capsys): def test_install_uninstalled_deps(install_mockery, monkeypatch, capsys):
"""Test install with uninstalled dependencies.""" """Test install with uninstalled dependencies."""
const_arg = installer_args(['dependent-install'], {}) const_arg = installer_args(['dependent-install'], {})
@ -888,6 +961,8 @@ def test_install_uninstalled_deps(install_mockery, monkeypatch, capsys):
assert 'Detected uninstalled dependencies for' in out assert 'Detected uninstalled dependencies for' in out
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_install_failed(install_mockery, monkeypatch, capsys): def test_install_failed(install_mockery, monkeypatch, capsys):
"""Test install with failed install.""" """Test install with failed install."""
const_arg = installer_args(['b'], {}) const_arg = installer_args(['b'], {})
@ -904,6 +979,8 @@ def test_install_failed(install_mockery, monkeypatch, capsys):
assert 'failed to install' in out assert 'failed to install' in out
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_install_failed_not_fast(install_mockery, monkeypatch, capsys): def test_install_failed_not_fast(install_mockery, monkeypatch, capsys):
"""Test install with failed install.""" """Test install with failed install."""
const_arg = installer_args(['a'], {'fail_fast': False}) const_arg = installer_args(['a'], {'fail_fast': False})
@ -920,6 +997,8 @@ def test_install_failed_not_fast(install_mockery, monkeypatch, capsys):
assert 'Skipping build of a' in out assert 'Skipping build of a' in out
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_install_fail_on_interrupt(install_mockery, monkeypatch): def test_install_fail_on_interrupt(install_mockery, monkeypatch):
"""Test ctrl-c interrupted install.""" """Test ctrl-c interrupted install."""
spec_name = 'a' spec_name = 'a'
@ -944,6 +1023,8 @@ def _interrupt(installer, task, **kwargs):
assert spec_name not in installer.installed assert spec_name not in installer.installed
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_install_fail_single(install_mockery, monkeypatch): def test_install_fail_single(install_mockery, monkeypatch):
"""Test expected results for failure of single package.""" """Test expected results for failure of single package."""
spec_name = 'a' spec_name = 'a'
@ -971,6 +1052,8 @@ def _install(installer, task, **kwargs):
assert spec_name not in installer.installed assert spec_name not in installer.installed
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_install_fail_multi(install_mockery, monkeypatch): def test_install_fail_multi(install_mockery, monkeypatch):
"""Test expected results for failure of multiple packages.""" """Test expected results for failure of multiple packages."""
spec_name = 'c' spec_name = 'c'
@ -998,6 +1081,8 @@ def _install(installer, task, **kwargs):
assert spec_name not in installer.installed assert spec_name not in installer.installed
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_install_fail_fast_on_detect(install_mockery, monkeypatch, capsys): def test_install_fail_fast_on_detect(install_mockery, monkeypatch, capsys):
"""Test fail_fast install when an install failure is detected.""" """Test fail_fast install when an install failure is detected."""
const_arg = installer_args(['b'], {'fail_fast': False}) const_arg = installer_args(['b'], {'fail_fast': False})
@ -1029,6 +1114,8 @@ def _test_install_fail_fast_on_except_patch(installer, **kwargs):
raise RuntimeError('mock patch failure') raise RuntimeError('mock patch failure')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_install_fail_fast_on_except(install_mockery, monkeypatch, capsys): def test_install_fail_fast_on_except(install_mockery, monkeypatch, capsys):
"""Test fail_fast install when an install failure results from an error.""" """Test fail_fast install when an install failure results from an error."""
const_arg = installer_args(['a'], {'fail_fast': True}) const_arg = installer_args(['a'], {'fail_fast': True})
@ -1051,6 +1138,8 @@ def test_install_fail_fast_on_except(install_mockery, monkeypatch, capsys):
assert 'Skipping build of a' in out assert 'Skipping build of a' in out
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_install_lock_failures(install_mockery, monkeypatch, capfd): def test_install_lock_failures(install_mockery, monkeypatch, capfd):
"""Cover basic install lock failure handling in a single pass.""" """Cover basic install lock failure handling in a single pass."""
def _requeued(installer, task): def _requeued(installer, task):
@ -1074,6 +1163,8 @@ def _requeued(installer, task):
assert exp in ln assert exp in ln
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_install_lock_installed_requeue(install_mockery, monkeypatch, capfd): def test_install_lock_installed_requeue(install_mockery, monkeypatch, capfd):
"""Cover basic install handling for installed package.""" """Cover basic install handling for installed package."""
const_arg = installer_args(['b'], {}) const_arg = installer_args(['b'], {})
@ -1109,6 +1200,8 @@ def _requeued(installer, task):
assert exp in ln assert exp in ln
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_install_read_locked_requeue(install_mockery, monkeypatch, capfd): def test_install_read_locked_requeue(install_mockery, monkeypatch, capfd):
"""Cover basic read lock handling for uninstalled package with requeue.""" """Cover basic read lock handling for uninstalled package with requeue."""
orig_fn = inst.PackageInstaller._ensure_locked orig_fn = inst.PackageInstaller._ensure_locked
@ -1147,6 +1240,8 @@ def _requeued(installer, task):
assert exp in ln assert exp in ln
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_install_skip_patch(install_mockery, mock_fetch): def test_install_skip_patch(install_mockery, mock_fetch):
"""Test the path skip_patch install path.""" """Test the path skip_patch install path."""
spec_name = 'b' spec_name = 'b'

View file

@ -3,6 +3,7 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os import os
import sys
import pytest import pytest
@ -38,6 +39,8 @@ def check_link_paths(filename, paths):
assert actual == expected assert actual == expected
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_icc16_link_paths(): def test_icc16_link_paths():
check_link_paths('icc-16.0.3.txt', [ check_link_paths('icc-16.0.3.txt', [
'/usr/tce/packages/intel/intel-16.0.3/compilers_and_libraries_2016.3.210/linux/compiler/lib/intel64_lin', # noqa '/usr/tce/packages/intel/intel-16.0.3/compilers_and_libraries_2016.3.210/linux/compiler/lib/intel64_lin', # noqa
@ -45,6 +48,8 @@ def test_icc16_link_paths():
'/usr/tce/packages/gcc/gcc-4.9.3/lib64']) '/usr/tce/packages/gcc/gcc-4.9.3/lib64'])
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_pgi_link_paths(): def test_pgi_link_paths():
check_link_paths('pgcc-16.3.txt', [ check_link_paths('pgcc-16.3.txt', [
'/usr/tce/packages/pgi/pgi-16.3/linux86-64/16.3/lib']) '/usr/tce/packages/pgi/pgi-16.3/linux86-64/16.3/lib'])
@ -58,6 +63,8 @@ def test_clang4_link_paths():
check_link_paths('clang-4.0.1.txt', []) check_link_paths('clang-4.0.1.txt', [])
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_xl_link_paths(): def test_xl_link_paths():
check_link_paths('xl-13.1.5.txt', [ check_link_paths('xl-13.1.5.txt', [
'/opt/ibm/xlsmp/4.1.5/lib', '/opt/ibm/xlsmp/4.1.5/lib',
@ -65,6 +72,8 @@ def test_xl_link_paths():
'/opt/ibm/xlC/13.1.5/lib']) '/opt/ibm/xlC/13.1.5/lib'])
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_cce_link_paths(): def test_cce_link_paths():
check_link_paths('cce-8.6.5.txt', [ check_link_paths('cce-8.6.5.txt', [
'/opt/gcc/6.1.0/snos/lib64', '/opt/gcc/6.1.0/snos/lib64',
@ -85,11 +94,15 @@ def test_cce_link_paths():
'/opt/cray/pe/cce/8.6.5/binutils/x86_64/x86_64-unknown-linux-gnu/lib']) '/opt/cray/pe/cce/8.6.5/binutils/x86_64/x86_64-unknown-linux-gnu/lib'])
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_clang_apple_ld_link_paths(): def test_clang_apple_ld_link_paths():
check_link_paths('clang-9.0.0-apple-ld.txt', [ check_link_paths('clang-9.0.0-apple-ld.txt', [
'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/lib']) # noqa '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/lib']) # noqa
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_nag_mixed_gcc_gnu_ld_link_paths(): def test_nag_mixed_gcc_gnu_ld_link_paths():
# This is a test of a mixed NAG/GCC toolchain, i.e. 'cxx' is set to g++ and # This is a test of a mixed NAG/GCC toolchain, i.e. 'cxx' is set to g++ and
# is used for the rpath detection. The reference compiler output is a # is used for the rpath detection. The reference compiler output is a
@ -101,6 +114,8 @@ def test_nag_mixed_gcc_gnu_ld_link_paths():
'/scratch/local1/spack/opt/spack/gcc-6.3.0-haswell/gcc-6.5.0-4sdjgrs/lib']) # noqa '/scratch/local1/spack/opt/spack/gcc-6.3.0-haswell/gcc-6.5.0-4sdjgrs/lib']) # noqa
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_nag_link_paths(): def test_nag_link_paths():
# This is a test of a NAG-only toolchain, i.e. 'cc' and 'cxx' are empty, # This is a test of a NAG-only toolchain, i.e. 'cc' and 'cxx' are empty,
# and therefore 'fc' is used for the rpath detection). The reference # and therefore 'fc' is used for the rpath detection). The reference
@ -112,6 +127,8 @@ def test_nag_link_paths():
'/scratch/local1/spack/opt/spack/gcc-6.3.0-haswell/gcc-6.5.0-4sdjgrs/lib']) # noqa '/scratch/local1/spack/opt/spack/gcc-6.3.0-haswell/gcc-6.5.0-4sdjgrs/lib']) # noqa
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_obscure_parsing_rules(): def test_obscure_parsing_rules():
check_link_paths('obscure-parsing-rules.txt', [ check_link_paths('obscure-parsing-rules.txt', [
'/first/path', '/first/path',

View file

@ -4,7 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import fnmatch import fnmatch
import os import posixpath
import pytest import pytest
import six import six
@ -198,7 +198,7 @@ def test_add(self, header_list):
#: Directory where the data for the test below is stored #: Directory where the data for the test below is stored
search_dir = os.path.join(spack.paths.test_path, 'data', 'directory_search') search_dir = posixpath.join(spack.paths.test_path, 'data', 'directory_search')
@pytest.mark.parametrize('search_fn,search_list,root,kwargs', [ @pytest.mark.parametrize('search_fn,search_list,root,kwargs', [
@ -229,12 +229,12 @@ def test_add(self, header_list):
(find_headers, ['a', 'c'], search_dir, {'recursive': True}), (find_headers, ['a', 'c'], search_dir, {'recursive': True}),
(find_libraries, (find_libraries,
['liba', 'libd'], ['liba', 'libd'],
os.path.join(search_dir, 'b'), posixpath.join(search_dir, 'b'),
{'recursive': False} {'recursive': False}
), ),
(find_headers, (find_headers,
['b', 'd'], ['b', 'd'],
os.path.join(search_dir, 'b'), posixpath.join(search_dir, 'b'),
{'recursive': False} {'recursive': False}
), ),
]) ])
@ -270,14 +270,14 @@ def test_searching_order(search_fn, search_list, root, kwargs):
@pytest.mark.parametrize('root,search_list,kwargs,expected', [ @pytest.mark.parametrize('root,search_list,kwargs,expected', [
(search_dir, '*/*bar.tx?', {'recursive': False}, [ (search_dir, '*/*bar.tx?', {'recursive': False}, [
os.path.join(search_dir, 'a/foobar.txt'), posixpath.join(search_dir, posixpath.join('a', 'foobar.txt')),
os.path.join(search_dir, 'b/bar.txp'), posixpath.join(search_dir, posixpath.join('b', 'bar.txp')),
os.path.join(search_dir, 'c/bar.txt'), posixpath.join(search_dir, posixpath.join('c', 'bar.txt')),
]), ]),
(search_dir, '*/*bar.tx?', {'recursive': True}, [ (search_dir, '*/*bar.tx?', {'recursive': True}, [
os.path.join(search_dir, 'a/foobar.txt'), posixpath.join(search_dir, posixpath.join('a', 'foobar.txt')),
os.path.join(search_dir, 'b/bar.txp'), posixpath.join(search_dir, posixpath.join('b', 'bar.txp')),
os.path.join(search_dir, 'c/bar.txt'), posixpath.join(search_dir, posixpath.join('c', 'bar.txt')),
]) ])
]) ])
def test_find_with_globbing(root, search_list, kwargs, expected): def test_find_with_globbing(root, search_list, kwargs, expected):

View file

@ -149,6 +149,7 @@ def test_multiple_src_file_dest(self, stage):
fs.install('source/a/*/*', 'dest/1') fs.install('source/a/*/*', 'dest/1')
@pytest.mark.skipif(os.name == 'nt', reason="Skip test on Windows")
class TestCopyTree: class TestCopyTree:
"""Tests for ``filesystem.copy_tree``""" """Tests for ``filesystem.copy_tree``"""
@ -237,6 +238,7 @@ def test_parent_dir(self, stage):
fs.copy_tree('source', 'source/sub/directory') fs.copy_tree('source', 'source/sub/directory')
@pytest.mark.skipif(os.name == 'nt', reason="Skip test on Windows")
class TestInstallTree: class TestInstallTree:
"""Tests for ``filesystem.install_tree``""" """Tests for ``filesystem.install_tree``"""
@ -365,6 +367,12 @@ def test_recursive_search_of_headers_from_prefix(
prefix = str(installation_dir_with_headers) prefix = str(installation_dir_with_headers)
header_list = fs.find_all_headers(prefix) header_list = fs.find_all_headers(prefix)
include_dirs = header_list.directories
if sys.platform == "win32":
header_list = [header.replace("/", "\\") for header in header_list]
include_dirs = [dir.replace("/", "\\") for dir in include_dirs]
# Check that the header files we expect are all listed # Check that the header files we expect are all listed
assert os.path.join(prefix, 'include', 'ex3.h') in header_list assert os.path.join(prefix, 'include', 'ex3.h') in header_list
assert os.path.join(prefix, 'include', 'boost', 'ex3.h') in header_list assert os.path.join(prefix, 'include', 'boost', 'ex3.h') in header_list
@ -372,20 +380,32 @@ def test_recursive_search_of_headers_from_prefix(
assert os.path.join(prefix, 'path', 'to', 'subdir', 'ex2.h') in header_list assert os.path.join(prefix, 'path', 'to', 'subdir', 'ex2.h') in header_list
# Check that when computing directories we exclude <prefix>/include/boost # Check that when computing directories we exclude <prefix>/include/boost
include_dirs = header_list.directories
assert os.path.join(prefix, 'include') in include_dirs assert os.path.join(prefix, 'include') in include_dirs
assert os.path.join(prefix, 'include', 'boost') not in include_dirs assert os.path.join(prefix, 'include', 'boost') not in include_dirs
assert os.path.join(prefix, 'path', 'to') in include_dirs assert os.path.join(prefix, 'path', 'to') in include_dirs
assert os.path.join(prefix, 'path', 'to', 'subdir') in include_dirs assert os.path.join(prefix, 'path', 'to', 'subdir') in include_dirs
@pytest.mark.parametrize('list_of_headers,expected_directories', [ if sys.platform == "win32":
(['/pfx/include/foo.h', '/pfx/include/subdir/foo.h'], ['/pfx/include']), # TODO: Test \\s
(['/pfx/include/foo.h', '/pfx/subdir/foo.h'], dir_list = [
['/pfx/include', '/pfx/subdir']), (['C:/pfx/include/foo.h', 'C:/pfx/include/subdir/foo.h'], ['C:/pfx/include']),
(['/pfx/include/subdir/foo.h', '/pfx/subdir/foo.h'], (['C:/pfx/include/foo.h', 'C:/pfx/subdir/foo.h'],
['/pfx/include', '/pfx/subdir']) ['C:/pfx/include', 'C:/pfx/subdir']),
]) (['C:/pfx/include/subdir/foo.h', 'C:/pfx/subdir/foo.h'],
['C:/pfx/include', 'C:/pfx/subdir'])
]
else:
dir_list = [
(['/pfx/include/foo.h', '/pfx/include/subdir/foo.h'], ['/pfx/include']),
(['/pfx/include/foo.h', '/pfx/subdir/foo.h'],
['/pfx/include', '/pfx/subdir']),
(['/pfx/include/subdir/foo.h', '/pfx/subdir/foo.h'],
['/pfx/include', '/pfx/subdir'])
]
@pytest.mark.parametrize('list_of_headers,expected_directories', dir_list)
def test_computation_of_header_directories( def test_computation_of_header_directories(
list_of_headers, expected_directories list_of_headers, expected_directories
): ):
@ -394,23 +414,32 @@ def test_computation_of_header_directories(
def test_headers_directory_setter(): def test_headers_directory_setter():
if sys.platform == "win32":
# TODO: Test with \\'s
root = "C:/pfx/include/subdir"
else:
root = "/pfx/include/subdir"
hl = fs.HeaderList( hl = fs.HeaderList(
['/pfx/include/subdir/foo.h', '/pfx/include/subdir/bar.h'] [root + '/foo.h', root + '/bar.h']
) )
# Set directories using a list # Set directories using a list
hl.directories = ['/pfx/include/subdir'] hl.directories = [root]
assert hl.directories == ['/pfx/include/subdir'] assert hl.directories == [root]
# If it's a single directory it's fine to not wrap it into a list # If it's a single directory it's fine to not wrap it into a list
# when setting the property # when setting the property
hl.directories = '/pfx/include/subdir' hl.directories = root
assert hl.directories == ['/pfx/include/subdir'] assert hl.directories == [root]
# Paths are normalized, so it doesn't matter how many backslashes etc. # Paths are normalized, so it doesn't matter how many backslashes etc.
# are present in the original directory being used # are present in the original directory being used
hl.directories = '/pfx/include//subdir/' if sys.platform == "win32":
assert hl.directories == ['/pfx/include/subdir'] # TODO: Test with \\'s
hl.directories = "C:/pfx/include//subdir"
else:
hl.directories = '/pfx/include//subdir/'
assert hl.directories == [root]
# Setting an empty list is allowed and returns an empty list # Setting an empty list is allowed and returns an empty list
hl.directories = [] hl.directories = []
@ -421,26 +450,53 @@ def test_headers_directory_setter():
assert hl.directories == [] assert hl.directories == []
@pytest.mark.parametrize('path,entry,expected', [ if sys.platform == "win32":
('/tmp/user/root', None, # TODO: Test \\s
(['/tmp', '/tmp/user', '/tmp/user/root'], '', [])), paths = [
('/tmp/user/root', 'tmp', ([], '/tmp', ['/tmp/user', '/tmp/user/root'])), ('C:/user/root', None,
('/tmp/user/root', 'user', (['/tmp'], '/tmp/user', ['/tmp/user/root'])), (['C:/', 'C:/user', 'C:/user/root'], '', [])),
('/tmp/user/root', 'root', (['/tmp', '/tmp/user'], '/tmp/user/root', [])), ('C:/user/root', 'C:/', ([], 'C:/', ['C:/user', 'C:/user/root'])),
('relative/path', None, (['relative', 'relative/path'], '', [])), ('C:/user/root', 'user', (['C:/'], 'C:/user', ['C:/user/root'])),
('relative/path', 'relative', ([], 'relative', ['relative/path'])), ('C:/user/root', 'root', (['C:/', 'C:/user'], 'C:/user/root', [])),
('relative/path', 'path', (['relative'], 'relative/path', [])) ('relative/path', None, (['relative', 'relative/path'], '', [])),
]) ('relative/path', 'relative', ([], 'relative', ['relative/path'])),
('relative/path', 'path', (['relative'], 'relative/path', []))
]
else:
paths = [
('/tmp/user/root', None,
(['/tmp', '/tmp/user', '/tmp/user/root'], '', [])),
('/tmp/user/root', 'tmp', ([], '/tmp', ['/tmp/user', '/tmp/user/root'])),
('/tmp/user/root', 'user', (['/tmp'], '/tmp/user', ['/tmp/user/root'])),
('/tmp/user/root', 'root', (['/tmp', '/tmp/user'], '/tmp/user/root', [])),
('relative/path', None, (['relative', 'relative/path'], '', [])),
('relative/path', 'relative', ([], 'relative', ['relative/path'])),
('relative/path', 'path', (['relative'], 'relative/path', []))
]
@pytest.mark.parametrize('path,entry,expected', paths)
def test_partition_path(path, entry, expected): def test_partition_path(path, entry, expected):
assert fs.partition_path(path, entry) == expected assert fs.partition_path(path, entry) == expected
@pytest.mark.parametrize('path,expected', [ if sys.platform == "win32":
('', []), path_list = [
('/tmp/user/dir', ['/tmp', '/tmp/user', '/tmp/user/dir']), ('', []),
('./some/sub/dir', ['./some', './some/sub', './some/sub/dir']), ('C:\\user\\dir', ['C:/', 'C:/user', 'C:/user/dir']),
('another/sub/dir', ['another', 'another/sub', 'another/sub/dir']) ('./some/sub/dir', ['./some', './some/sub', './some/sub/dir']),
]) ('another/sub/dir', ['another', 'another/sub', 'another/sub/dir'])
]
else:
path_list = [
('', []),
('/tmp/user/dir', ['/tmp', '/tmp/user', '/tmp/user/dir']),
('./some/sub/dir', ['./some', './some/sub', './some/sub/dir']),
('another/sub/dir', ['another', 'another/sub', 'another/sub/dir'])
]
@pytest.mark.parametrize('path,expected', path_list)
def test_prefixes(path, expected): def test_prefixes(path, expected):
assert fs.prefixes(path) == expected assert fs.prefixes(path) == expected

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os import os
import sys
import pytest import pytest
@ -52,6 +53,8 @@ def check_dir(filename):
assert os.path.isdir(filename) assert os.path.isdir(filename)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_merge_to_new_directory(stage, link_tree): def test_merge_to_new_directory(stage, link_tree):
with working_dir(stage.path): with working_dir(stage.path):
link_tree.merge('dest') link_tree.merge('dest')
@ -77,6 +80,8 @@ def test_merge_to_new_directory(stage, link_tree):
assert not os.path.exists('dest') assert not os.path.exists('dest')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_merge_to_new_directory_relative(stage, link_tree): def test_merge_to_new_directory_relative(stage, link_tree):
with working_dir(stage.path): with working_dir(stage.path):
link_tree.merge('dest', relative=True) link_tree.merge('dest', relative=True)
@ -102,6 +107,8 @@ def test_merge_to_new_directory_relative(stage, link_tree):
assert not os.path.exists('dest') assert not os.path.exists('dest')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_merge_to_existing_directory(stage, link_tree): def test_merge_to_existing_directory(stage, link_tree):
with working_dir(stage.path): with working_dir(stage.path):
@ -135,6 +142,8 @@ def test_merge_to_existing_directory(stage, link_tree):
assert not os.path.isfile('dest/c/d/e/7') assert not os.path.isfile('dest/c/d/e/7')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_merge_with_empty_directories(stage, link_tree): def test_merge_with_empty_directories(stage, link_tree):
with working_dir(stage.path): with working_dir(stage.path):
mkdirp('dest/f/g') mkdirp('dest/f/g')
@ -155,6 +164,8 @@ def test_merge_with_empty_directories(stage, link_tree):
assert os.path.isdir('dest/f/g') assert os.path.isdir('dest/f/g')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_ignore(stage, link_tree): def test_ignore(stage, link_tree):
with working_dir(stage.path): with working_dir(stage.path):
touchp('source/.spec') touchp('source/.spec')

View file

@ -44,16 +44,17 @@
""" """
import collections import collections
import errno import errno
import fcntl
import getpass import getpass
import glob import glob
import os import os
import shutil import shutil
import socket import socket
import stat
import tempfile import tempfile
import traceback import traceback
from contextlib import contextmanager from contextlib import contextmanager
from multiprocessing import Process, Queue from multiprocessing import Process, Queue
from sys import platform as _platform
import pytest import pytest
@ -61,6 +62,17 @@
import llnl.util.multiproc as mp import llnl.util.multiproc as mp
from llnl.util.filesystem import getuid, touch from llnl.util.filesystem import getuid, touch
if _platform == "win32":
import pywintypes
import win32con
import win32file
LOCK_EX = win32con.LOCKFILE_EXCLUSIVE_LOCK
LOCK_SH = 0
LOCK_NB = win32con.LOCKFILE_FAIL_IMMEDIATELY
__overlapped = pywintypes.OVERLAPPED()
else:
import fcntl
# #
# This test can be run with MPI. MPI is "enabled" if we can import # This test can be run with MPI. MPI is "enabled" if we can import
# mpi4py and the number of total MPI processes is greater than 1. # mpi4py and the number of total MPI processes is greater than 1.
@ -112,14 +124,25 @@
def make_readable(*paths): def make_readable(*paths):
# TODO: From os.chmod doc:
# "Note Although Windows supports chmod(), you can only
# set the file's read-only flag with it (via the stat.S_IWRITE and
# stat.S_IREAD constants or a corresponding integer value). All other
# bits are ignored."
for path in paths: for path in paths:
mode = 0o555 if os.path.isdir(path) else 0o444 if (_platform != 'win32'):
mode = 0o555 if os.path.isdir(path) else 0o444
else:
mode = stat.S_IREAD
os.chmod(path, mode) os.chmod(path, mode)
def make_writable(*paths): def make_writable(*paths):
for path in paths: for path in paths:
mode = 0o755 if os.path.isdir(path) else 0o744 if (_platform != 'win32'):
mode = 0o755 if os.path.isdir(path) else 0o744
else:
mode = stat.S_IWRITE
os.chmod(path, mode) os.chmod(path, mode)
@ -377,6 +400,8 @@ def test_write_lock_timeout_on_write_ranges(lock_path):
TimeoutWrite(lock_path, 0, 1)) TimeoutWrite(lock_path, 0, 1))
@pytest.mark.skipif(_platform == 'win32',
reason='locking ranges not supported on windows')
def test_write_lock_timeout_on_write_ranges_2(lock_path): def test_write_lock_timeout_on_write_ranges_2(lock_path):
multiproc_test( multiproc_test(
AcquireWrite(lock_path, 0, 64), AcquireWrite(lock_path, 0, 64),
@ -385,6 +410,8 @@ def test_write_lock_timeout_on_write_ranges_2(lock_path):
TimeoutWrite(lock_path, 63, 1)) TimeoutWrite(lock_path, 63, 1))
@pytest.mark.skipif(_platform == 'win32',
reason='locking ranges not supported on windows')
def test_write_lock_timeout_on_write_ranges_3(lock_path): def test_write_lock_timeout_on_write_ranges_3(lock_path):
multiproc_test( multiproc_test(
AcquireWrite(lock_path, 0, 1), AcquireWrite(lock_path, 0, 1),
@ -394,6 +421,8 @@ def test_write_lock_timeout_on_write_ranges_3(lock_path):
TimeoutWrite(lock_path)) TimeoutWrite(lock_path))
@pytest.mark.skipif(_platform == 'win32',
reason='locking ranges not supported on windows')
def test_write_lock_timeout_on_write_ranges_4(lock_path): def test_write_lock_timeout_on_write_ranges_4(lock_path):
multiproc_test( multiproc_test(
AcquireWrite(lock_path, 0, 1), AcquireWrite(lock_path, 0, 1),
@ -444,6 +473,8 @@ def test_read_lock_timeout_on_write_ranges_2(lock_path):
TimeoutRead(lock_path, 0, 1)) TimeoutRead(lock_path, 0, 1))
@pytest.mark.skipif(_platform == 'win32',
reason='locking ranges not supported on windows')
def test_read_lock_timeout_on_write_ranges_3(lock_path): def test_read_lock_timeout_on_write_ranges_3(lock_path):
"""two write locks, overlapping read locks""" """two write locks, overlapping read locks"""
multiproc_test( multiproc_test(
@ -489,6 +520,8 @@ def test_write_lock_timeout_on_read_ranges_2(lock_path):
TimeoutWrite(lock_path, 0, 1)) TimeoutWrite(lock_path, 0, 1))
@pytest.mark.skipif(_platform == 'win32',
reason='locking ranges not supported on windows')
def test_write_lock_timeout_on_read_ranges_3(lock_path): def test_write_lock_timeout_on_read_ranges_3(lock_path):
multiproc_test( multiproc_test(
AcquireRead(lock_path, 0, 1), AcquireRead(lock_path, 0, 1),
@ -547,6 +580,8 @@ def test_write_lock_timeout_with_multiple_readers_3_2(lock_path):
TimeoutWrite(lock_path)) TimeoutWrite(lock_path))
@pytest.mark.skipif(_platform == 'win32',
reason='locking ranges not supported on windows')
def test_write_lock_timeout_with_multiple_readers_2_1_ranges(lock_path): def test_write_lock_timeout_with_multiple_readers_2_1_ranges(lock_path):
multiproc_test( multiproc_test(
AcquireRead(lock_path, 0, 10), AcquireRead(lock_path, 0, 10),
@ -554,6 +589,8 @@ def test_write_lock_timeout_with_multiple_readers_2_1_ranges(lock_path):
TimeoutWrite(lock_path, 5, 5)) TimeoutWrite(lock_path, 5, 5))
@pytest.mark.skipif(_platform == 'win32',
reason='locking ranges not supported on windows')
def test_write_lock_timeout_with_multiple_readers_2_3_ranges(lock_path): def test_write_lock_timeout_with_multiple_readers_2_3_ranges(lock_path):
multiproc_test( multiproc_test(
AcquireRead(lock_path, 0, 10), AcquireRead(lock_path, 0, 10),
@ -608,7 +645,7 @@ def test_read_lock_read_only_dir_writable_lockfile(lock_dir, lock_path):
pass pass
@pytest.mark.skipif(os.getuid() == 0, reason='user is root') @pytest.mark.skipif(_platform == 'win32' or getuid() == 0, reason='user is root')
def test_read_lock_no_lockfile(lock_dir, lock_path): def test_read_lock_no_lockfile(lock_dir, lock_path):
"""read-only directory, no lockfile (so can't create).""" """read-only directory, no lockfile (so can't create)."""
with read_only(lock_dir): with read_only(lock_dir):
@ -623,6 +660,8 @@ def test_read_lock_no_lockfile(lock_dir, lock_path):
pass pass
@pytest.mark.skipif(_platform == 'win32',
reason='not supported on windows')
def test_upgrade_read_to_write(private_lock_path): def test_upgrade_read_to_write(private_lock_path):
"""Test that a read lock can be upgraded to a write lock. """Test that a read lock can be upgraded to a write lock.
@ -670,15 +709,18 @@ def test_upgrade_read_to_write_fails_with_readonly_file(private_lock_path):
lock = lk.Lock(private_lock_path) lock = lk.Lock(private_lock_path)
assert lock._reads == 0 assert lock._reads == 0
assert lock._writes == 0 assert lock._writes == 0
assert lock._current_lock is None
lock.acquire_read() lock.acquire_read()
assert lock._reads == 1 assert lock._reads == 1
assert lock._writes == 0 assert lock._writes == 0
assert lock._file.mode == 'r' assert lock._file.mode == 'r'
assert lock._current_lock == lock.LOCK_SH
# upgrade to writ here # upgrade to write here
with pytest.raises(lk.LockROFileError): with pytest.raises(lk.LockROFileError):
lock.acquire_write() lock.acquire_write()
lk.file_tracker.release_fh(lock.path)
class ComplexAcquireAndRelease(object): class ComplexAcquireAndRelease(object):
@ -1254,6 +1296,8 @@ def p2(self, barrier, q1, q2):
barrier.wait() # ---------------------------------------- 4 barrier.wait() # ---------------------------------------- 4
@pytest.mark.skipif(_platform == 'win32',
reason='debug output not supported on windows')
def test_lock_debug_output(lock_path): def test_lock_debug_output(lock_path):
test_debug = LockDebugOutput(lock_path) test_debug = LockDebugOutput(lock_path)
q1, q2 = Queue(), Queue() q1, q2 = Queue(), Queue()
@ -1326,6 +1370,8 @@ def test_downgrade_write_fails(tmpdir):
[(errno.EACCES, "Fake EACCES error"), [(errno.EACCES, "Fake EACCES error"),
(errno.EAGAIN, "Fake EAGAIN error"), (errno.EAGAIN, "Fake EAGAIN error"),
(errno.ENOENT, "Fake ENOENT error")]) (errno.ENOENT, "Fake ENOENT error")])
@pytest.mark.skipif(_platform == 'win32',
reason='not supported on windows')
def test_poll_lock_exception(tmpdir, monkeypatch, err_num, err_msg): def test_poll_lock_exception(tmpdir, monkeypatch, err_num, err_msg):
"""Test poll lock exception handling.""" """Test poll lock exception handling."""
def _lockf(fd, cmd, len, start, whence): def _lockf(fd, cmd, len, start, whence):
@ -1336,14 +1382,23 @@ def _lockf(fd, cmd, len, start, whence):
lock = lk.Lock(lockfile) lock = lk.Lock(lockfile)
touch(lockfile) touch(lockfile)
if _platform == 'win32':
monkeypatch.setattr(win32file, 'LockFileEx', _lockf)
monkeypatch.setattr(fcntl, 'lockf', _lockf) if err_num in [errno.EAGAIN, errno.EACCES]:
assert not lock._poll_lock(win32con.LOCKFILE_EXCLUSIVE_LOCK)
else:
with pytest.raises(IOError, match=err_msg):
lock._poll_lock(win32con.LOCKFILE_EXCLUSIVE_LOCK)
if err_num in [errno.EAGAIN, errno.EACCES]:
assert not lock._poll_lock(fcntl.LOCK_EX)
else: else:
with pytest.raises(IOError, match=err_msg): monkeypatch.setattr(fcntl, 'lockf', _lockf)
lock._poll_lock(fcntl.LOCK_EX)
if err_num in [errno.EAGAIN, errno.EACCES]:
assert not lock._poll_lock(fcntl.LOCK_EX)
else:
with pytest.raises(IOError, match=err_msg):
lock._poll_lock(fcntl.LOCK_EX)
def test_upgrade_read_okay(tmpdir): def test_upgrade_read_okay(tmpdir):

View file

@ -32,6 +32,12 @@
pass pass
@contextlib.contextmanager
def nullcontext():
yield
@pytest.mark.skipif(sys.platform == 'win32', reason="echo not implemented on windows")
def test_log_python_output_with_echo(capfd, tmpdir): def test_log_python_output_with_echo(capfd, tmpdir):
with tmpdir.as_cwd(): with tmpdir.as_cwd():
with log.log_output('foo.txt', echo=True): with log.log_output('foo.txt', echo=True):
@ -45,6 +51,7 @@ def test_log_python_output_with_echo(capfd, tmpdir):
assert capfd.readouterr()[0] == 'logged\n' assert capfd.readouterr()[0] == 'logged\n'
@pytest.mark.skipif(sys.platform == 'win32', reason="echo not implemented on windows")
def test_log_python_output_without_echo(capfd, tmpdir): def test_log_python_output_without_echo(capfd, tmpdir):
with tmpdir.as_cwd(): with tmpdir.as_cwd():
with log.log_output('foo.txt'): with log.log_output('foo.txt'):
@ -58,6 +65,7 @@ def test_log_python_output_without_echo(capfd, tmpdir):
assert capfd.readouterr()[0] == '' assert capfd.readouterr()[0] == ''
@pytest.mark.skipif(sys.platform == 'win32', reason="echo not implemented on windows")
def test_log_python_output_with_invalid_utf8(capfd, tmpdir): def test_log_python_output_with_invalid_utf8(capfd, tmpdir):
with tmpdir.as_cwd(): with tmpdir.as_cwd():
with log.log_output('foo.txt'): with log.log_output('foo.txt'):
@ -76,6 +84,7 @@ def test_log_python_output_with_invalid_utf8(capfd, tmpdir):
assert capfd.readouterr()[0] == '' assert capfd.readouterr()[0] == ''
@pytest.mark.skipif(sys.platform == 'win32', reason="echo not implemented on windows")
def test_log_python_output_and_echo_output(capfd, tmpdir): def test_log_python_output_and_echo_output(capfd, tmpdir):
with tmpdir.as_cwd(): with tmpdir.as_cwd():
# echo two lines # echo two lines
@ -96,6 +105,8 @@ def _log_filter_fn(string):
return string.replace("foo", "bar") return string.replace("foo", "bar")
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_log_output_with_filter(capfd, tmpdir): def test_log_output_with_filter(capfd, tmpdir):
with tmpdir.as_cwd(): with tmpdir.as_cwd():
with log.log_output('foo.txt', filter_fn=_log_filter_fn): with log.log_output('foo.txt', filter_fn=_log_filter_fn):
@ -125,7 +136,7 @@ def test_log_output_with_filter(capfd, tmpdir):
assert capfd.readouterr()[0] == 'bar blah\nblah bar\nbar bar\n' assert capfd.readouterr()[0] == 'bar blah\nblah bar\nbar bar\n'
@pytest.mark.skipif(not which('echo'), reason="needs echo command") @pytest.mark.skipif(not which('echo') or os.name == 'nt', reason="needs echo command")
def test_log_subproc_and_echo_output_no_capfd(capfd, tmpdir): def test_log_subproc_and_echo_output_no_capfd(capfd, tmpdir):
echo = which('echo') echo = which('echo')
@ -143,7 +154,7 @@ def test_log_subproc_and_echo_output_no_capfd(capfd, tmpdir):
assert f.read() == 'echo\nlogged\n' assert f.read() == 'echo\nlogged\n'
@pytest.mark.skipif(not which('echo'), reason="needs echo command") @pytest.mark.skipif(not which('echo') or os.name == 'nt', reason="needs echo command")
def test_log_subproc_and_echo_output_capfd(capfd, tmpdir): def test_log_subproc_and_echo_output_capfd(capfd, tmpdir):
echo = which('echo') echo = which('echo')

View file

@ -4,6 +4,9 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os import os
import sys
import pytest
import llnl.util.filesystem as fs import llnl.util.filesystem as fs
@ -23,6 +26,8 @@ def test_get_version_no_match_git(tmpdir, working_env):
assert spack.spack_version == get_version() assert spack.spack_version == get_version()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_get_version_match_git(tmpdir, working_env): def test_get_version_match_git(tmpdir, working_env):
git = str(tmpdir.join("git")) git = str(tmpdir.join("git"))
with open(git, "w") as f: with open(git, "w") as f:

View file

@ -10,13 +10,18 @@
""" """
import os import os
import shutil import shutil
import sys
import tempfile import tempfile
import unittest import unittest
import pytest
from spack.build_environment import MakeExecutable from spack.build_environment import MakeExecutable
from spack.util.environment import path_put_first from spack.util.environment import path_put_first
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
class MakeExecutableTest(unittest.TestCase): class MakeExecutableTest(unittest.TestCase):
def setUp(self): def setUp(self):

View file

@ -5,6 +5,7 @@
import filecmp import filecmp
import os import os
import sys
import pytest import pytest
@ -103,12 +104,16 @@ def check_mirror():
assert all(left in exclude for left in dcmp.left_only) assert all(left in exclude for left in dcmp.left_only)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_url_mirror(mock_archive): def test_url_mirror(mock_archive):
set_up_package('trivial-install-test-package', mock_archive, 'url') set_up_package('trivial-install-test-package', mock_archive, 'url')
check_mirror() check_mirror()
repos.clear() repos.clear()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.skipif( @pytest.mark.skipif(
not which('git'), reason='requires git to be installed') not which('git'), reason='requires git to be installed')
def test_git_mirror(mock_git_repository): def test_git_mirror(mock_git_repository):
@ -117,6 +122,8 @@ def test_git_mirror(mock_git_repository):
repos.clear() repos.clear()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.skipif( @pytest.mark.skipif(
not which('svn') or not which('svnadmin'), not which('svn') or not which('svnadmin'),
reason='requires subversion to be installed') reason='requires subversion to be installed')
@ -126,6 +133,8 @@ def test_svn_mirror(mock_svn_repository):
repos.clear() repos.clear()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.skipif( @pytest.mark.skipif(
not which('hg'), reason='requires mercurial to be installed') not which('hg'), reason='requires mercurial to be installed')
def test_hg_mirror(mock_hg_repository): def test_hg_mirror(mock_hg_repository):
@ -134,6 +143,8 @@ def test_hg_mirror(mock_hg_repository):
repos.clear() repos.clear()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.skipif( @pytest.mark.skipif(
not all([which('svn'), which('hg'), which('git')]), not all([which('svn'), which('hg'), which('git')]),
reason='requires subversion, git, and mercurial to be installed') reason='requires subversion, git, and mercurial to be installed')
@ -151,6 +162,8 @@ def test_all_mirror(
repos.clear() repos.clear()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize( @pytest.mark.parametrize(
"mirror", "mirror",
[ [
@ -167,6 +180,8 @@ def test_roundtrip_mirror(mirror):
assert spack.mirror.Mirror.from_json(mirror_json) == mirror assert spack.mirror.Mirror.from_json(mirror_json) == mirror
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize( @pytest.mark.parametrize(
"invalid_yaml", "invalid_yaml",
[ [
@ -181,6 +196,8 @@ def test_invalid_yaml_mirror(invalid_yaml):
assert invalid_yaml in exc_msg assert invalid_yaml in exc_msg
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize( @pytest.mark.parametrize(
"invalid_json, error_message", "invalid_json, error_message",
[ [
@ -195,6 +212,8 @@ def test_invalid_json_mirror(invalid_json, error_message):
assert error_message in exc_msg assert error_message in exc_msg
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize( @pytest.mark.parametrize(
"mirror_collection", "mirror_collection",
[ [
@ -217,6 +236,8 @@ def test_roundtrip_mirror_collection(mirror_collection):
mirror_collection) mirror_collection)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize( @pytest.mark.parametrize(
"invalid_yaml", "invalid_yaml",
[ [
@ -231,6 +252,8 @@ def test_invalid_yaml_mirror_collection(invalid_yaml):
assert invalid_yaml in exc_msg assert invalid_yaml in exc_msg
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.parametrize( @pytest.mark.parametrize(
"invalid_json, error_message", "invalid_json, error_message",
[ [
@ -245,12 +268,16 @@ def test_invalid_json_mirror_collection(invalid_json, error_message):
assert error_message in exc_msg assert error_message in exc_msg
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_mirror_archive_paths_no_version(mock_packages, config, mock_archive): def test_mirror_archive_paths_no_version(mock_packages, config, mock_archive):
spec = Spec('trivial-install-test-package@nonexistingversion') spec = Spec('trivial-install-test-package@nonexistingversion')
fetcher = spack.fetch_strategy.URLFetchStrategy(mock_archive.url) fetcher = spack.fetch_strategy.URLFetchStrategy(mock_archive.url)
spack.mirror.mirror_archive_paths(fetcher, 'per-package-ref', spec) spack.mirror.mirror_archive_paths(fetcher, 'per-package-ref', spec)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_mirror_with_url_patches(mock_packages, config, monkeypatch): def test_mirror_with_url_patches(mock_packages, config, monkeypatch):
spec = Spec('patch-several-dependencies') spec = Spec('patch-several-dependencies')
spec.concretize() spec.concretize()
@ -303,6 +330,8 @@ def archive(dst):
pass pass
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.regression('14067') @pytest.mark.regression('14067')
def test_mirror_cache_symlinks(tmpdir): def test_mirror_cache_symlinks(tmpdir):
"""Confirm that the cosmetic symlink created in the mirror cache (which may """Confirm that the cosmetic symlink created in the mirror cache (which may

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os import os
import sys
import pytest import pytest
@ -23,6 +24,8 @@
'prepend-path PATH /path/to/bin'] 'prepend-path PATH /path/to/bin']
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_module_function_change_env(tmpdir, working_env): def test_module_function_change_env(tmpdir, working_env):
src_file = str(tmpdir.join('src_me')) src_file = str(tmpdir.join('src_me'))
with open(src_file, 'w') as f: with open(src_file, 'w') as f:
@ -35,6 +38,8 @@ def test_module_function_change_env(tmpdir, working_env):
assert os.environ['NOT_AFFECTED'] == "NOT_AFFECTED" assert os.environ['NOT_AFFECTED'] == "NOT_AFFECTED"
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_module_function_no_change(tmpdir): def test_module_function_no_change(tmpdir):
src_file = str(tmpdir.join('src_me')) src_file = str(tmpdir.join('src_me'))
with open(src_file, 'w') as f: with open(src_file, 'w') as f:

View file

@ -78,6 +78,7 @@ def mock_package_perms(monkeypatch):
yield perms yield perms
@pytest.mark.skipif(os.name == 'nt', reason="Skip test on Windows")
def test_modules_written_with_proper_permissions(mock_module_filename, def test_modules_written_with_proper_permissions(mock_module_filename,
mock_package_perms, mock_package_perms,
mock_packages, config): mock_packages, config):
@ -92,6 +93,8 @@ def test_modules_written_with_proper_permissions(mock_module_filename,
mock_module_filename).st_mode == mock_package_perms mock_module_filename).st_mode == mock_package_perms
@pytest.mark.skipif(str(spack.platforms.host()) == "windows",
reason="test unsupported on Windows")
@pytest.mark.parametrize('module_type', ['tcl', 'lmod']) @pytest.mark.parametrize('module_type', ['tcl', 'lmod'])
def test_modules_default_symlink( def test_modules_default_symlink(
module_type, mock_packages, mock_module_filename, mock_module_defaults, config module_type, mock_packages, mock_module_filename, mock_module_defaults, config
@ -217,6 +220,7 @@ def test_get_module_upstream():
spack.modules.common.upstream_module_index = old_index spack.modules.common.upstream_module_index = old_index
@pytest.mark.skipif(os.name == 'nt', reason="Skip test on Windows")
def test_load_installed_package_not_in_repo(install_mockery, mock_fetch, def test_load_installed_package_not_in_repo(install_mockery, mock_fetch,
monkeypatch): monkeypatch):
# Get a basic concrete spec for the trivial install package. # Get a basic concrete spec for the trivial install package.

View file

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

View file

@ -3,6 +3,9 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import sys
import pytest import pytest
import spack.modules.common import spack.modules.common
@ -20,6 +23,7 @@
@pytest.mark.usefixtures('config', 'mock_packages') @pytest.mark.usefixtures('config', 'mock_packages')
class TestTcl(object): class TestTcl(object):
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_simple_case(self, modulefile_content, module_configuration): def test_simple_case(self, modulefile_content, module_configuration):
"""Tests the generation of a simple TCL module file.""" """Tests the generation of a simple TCL module file."""
@ -28,6 +32,7 @@ def test_simple_case(self, modulefile_content, module_configuration):
assert 'module-whatis "mpich @3.0.4"' in content assert 'module-whatis "mpich @3.0.4"' in content
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_autoload_direct(self, modulefile_content, module_configuration): def test_autoload_direct(self, modulefile_content, module_configuration):
"""Tests the automatic loading of direct dependencies.""" """Tests the automatic loading of direct dependencies."""
@ -51,6 +56,7 @@ def test_autoload_direct(self, modulefile_content, module_configuration):
messages = [x for x in content if 'puts stderr "Autoloading' in x] messages = [x for x in content if 'puts stderr "Autoloading' in x]
assert len(messages) == 0 assert len(messages) == 0
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_autoload_all(self, modulefile_content, module_configuration): def test_autoload_all(self, modulefile_content, module_configuration):
"""Tests the automatic loading of all dependencies.""" """Tests the automatic loading of all dependencies."""
@ -74,6 +80,7 @@ def test_autoload_all(self, modulefile_content, module_configuration):
messages = [x for x in content if 'puts stderr "Autoloading' in x] messages = [x for x in content if 'puts stderr "Autoloading' in x]
assert len(messages) == 2 assert len(messages) == 2
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_prerequisites_direct( def test_prerequisites_direct(
self, modulefile_content, module_configuration self, modulefile_content, module_configuration
): ):
@ -84,6 +91,7 @@ def test_prerequisites_direct(
assert len([x for x in content if 'prereq' in x]) == 2 assert len([x for x in content if 'prereq' in x]) == 2
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_prerequisites_all(self, modulefile_content, module_configuration): def test_prerequisites_all(self, modulefile_content, module_configuration):
"""Tests asking all dependencies as prerequisites.""" """Tests asking all dependencies as prerequisites."""
@ -92,6 +100,7 @@ def test_prerequisites_all(self, modulefile_content, module_configuration):
assert len([x for x in content if 'prereq' in x]) == 5 assert len([x for x in content if 'prereq' in x]) == 5
@pytest.mark.skipif(os.name == 'nt', reason="Skip test on Windows")
def test_alter_environment(self, modulefile_content, module_configuration): def test_alter_environment(self, modulefile_content, module_configuration):
"""Tests modifications to run-time environment.""" """Tests modifications to run-time environment."""
@ -124,6 +133,7 @@ def test_alter_environment(self, modulefile_content, module_configuration):
assert len([x for x in content if 'module load foo/bar' in x]) == 1 assert len([x for x in content if 'module load foo/bar' in x]) == 1
assert len([x for x in content if 'setenv LIBDWARF_ROOT' in x]) == 1 assert len([x for x in content if 'setenv LIBDWARF_ROOT' in x]) == 1
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_blacklist(self, modulefile_content, module_configuration): def test_blacklist(self, modulefile_content, module_configuration):
"""Tests blacklisting the generation of selected modules.""" """Tests blacklisting the generation of selected modules."""
@ -144,6 +154,7 @@ def test_blacklist(self, modulefile_content, module_configuration):
assert len([x for x in content if 'is-loaded' in x]) == 1 assert len([x for x in content if 'is-loaded' in x]) == 1
assert len([x for x in content if 'module load ' in x]) == 1 assert len([x for x in content if 'module load ' in x]) == 1
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_naming_scheme_compat(self, factory, module_configuration): def test_naming_scheme_compat(self, factory, module_configuration):
"""Tests backwards compatibility for naming_scheme key""" """Tests backwards compatibility for naming_scheme key"""
module_configuration('naming_scheme') module_configuration('naming_scheme')
@ -158,6 +169,7 @@ def test_naming_scheme_compat(self, factory, module_configuration):
projection = writer.spec.format(writer.conf.projections['all']) projection = writer.spec.format(writer.conf.projections['all'])
assert projection in writer.layout.use_name assert projection in writer.layout.use_name
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_projections_specific(self, factory, module_configuration): def test_projections_specific(self, factory, module_configuration):
"""Tests reading the correct naming scheme.""" """Tests reading the correct naming scheme."""
@ -176,6 +188,7 @@ def test_projections_specific(self, factory, module_configuration):
projection = writer.spec.format(writer.conf.projections['mpileaks']) projection = writer.spec.format(writer.conf.projections['mpileaks'])
assert projection in writer.layout.use_name assert projection in writer.layout.use_name
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_projections_all(self, factory, module_configuration): def test_projections_all(self, factory, module_configuration):
"""Tests reading the correct naming scheme.""" """Tests reading the correct naming scheme."""
@ -194,6 +207,7 @@ def test_projections_all(self, factory, module_configuration):
projection = writer.spec.format(writer.conf.projections['all']) projection = writer.spec.format(writer.conf.projections['all'])
assert projection in writer.layout.use_name assert projection in writer.layout.use_name
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_invalid_naming_scheme(self, factory, module_configuration): def test_invalid_naming_scheme(self, factory, module_configuration):
"""Tests the evaluation of an invalid naming scheme.""" """Tests the evaluation of an invalid naming scheme."""
@ -205,6 +219,7 @@ def test_invalid_naming_scheme(self, factory, module_configuration):
with pytest.raises(RuntimeError): with pytest.raises(RuntimeError):
writer.layout.use_name writer.layout.use_name
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_invalid_token_in_env_name(self, factory, module_configuration): def test_invalid_token_in_env_name(self, factory, module_configuration):
"""Tests setting environment variables with an invalid name.""" """Tests setting environment variables with an invalid name."""
@ -214,6 +229,7 @@ def test_invalid_token_in_env_name(self, factory, module_configuration):
with pytest.raises(RuntimeError): with pytest.raises(RuntimeError):
writer.write() writer.write()
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_conflicts(self, modulefile_content, module_configuration): def test_conflicts(self, modulefile_content, module_configuration):
"""Tests adding conflicts to the module.""" """Tests adding conflicts to the module."""
@ -231,6 +247,7 @@ def test_conflicts(self, modulefile_content, module_configuration):
with pytest.raises(SystemExit): with pytest.raises(SystemExit):
modulefile_content('mpileaks') modulefile_content('mpileaks')
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_module_index( def test_module_index(
self, module_configuration, factory, tmpdir_factory): self, module_configuration, factory, tmpdir_factory):
@ -265,6 +282,7 @@ def test_module_index(
assert len(index) == 1 assert len(index) == 1
assert index[s3.dag_hash()].use_name == w3.layout.use_name assert index[s3.dag_hash()].use_name == w3.layout.use_name
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_suffixes(self, module_configuration, factory): def test_suffixes(self, module_configuration, factory):
"""Tests adding suffixes to module file name.""" """Tests adding suffixes to module file name."""
module_configuration('suffix') module_configuration('suffix')
@ -280,6 +298,7 @@ def test_suffixes(self, module_configuration, factory):
writer, spec = factory('mpileaks~debug+opt target=x86_64') writer, spec = factory('mpileaks~debug+opt target=x86_64')
assert 'baz-foo-bar' in writer.layout.use_name assert 'baz-foo-bar' in writer.layout.use_name
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_setup_environment(self, modulefile_content, module_configuration): def test_setup_environment(self, modulefile_content, module_configuration):
"""Tests the internal set-up of run-time environment.""" """Tests the internal set-up of run-time environment."""
@ -300,6 +319,7 @@ def test_setup_environment(self, modulefile_content, module_configuration):
[x for x in content if 'setenv FOOBAR "callpath"' in x] [x for x in content if 'setenv FOOBAR "callpath"' in x]
) == 1 ) == 1
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_override_config(self, module_configuration, factory): def test_override_config(self, module_configuration, factory):
"""Tests overriding some sections of the configuration file.""" """Tests overriding some sections of the configuration file."""
module_configuration('override_config') module_configuration('override_config')
@ -314,6 +334,7 @@ def test_override_config(self, module_configuration, factory):
assert 'mpich' not in writer.layout.use_name assert 'mpich' not in writer.layout.use_name
assert 'static' not in writer.layout.use_name assert 'static' not in writer.layout.use_name
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_override_template_in_package( def test_override_template_in_package(
self, modulefile_content, module_configuration self, modulefile_content, module_configuration
): ):
@ -324,6 +345,7 @@ def test_override_template_in_package(
assert 'Override successful!' in content assert 'Override successful!' in content
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_override_template_in_modules_yaml( def test_override_template_in_modules_yaml(
self, modulefile_content, module_configuration self, modulefile_content, module_configuration
): ):
@ -336,6 +358,7 @@ def test_override_template_in_modules_yaml(
content = modulefile_content('mpileaks target=x86_64') content = modulefile_content('mpileaks target=x86_64')
assert 'Override even better!' in content assert 'Override even better!' in content
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_extend_context( def test_extend_context(
self, modulefile_content, module_configuration self, modulefile_content, module_configuration
): ):
@ -348,6 +371,7 @@ def test_extend_context(
short_description = 'module-whatis "This package updates the context for TCL modulefiles."' # NOQA: ignore=E501 short_description = 'module-whatis "This package updates the context for TCL modulefiles."' # NOQA: ignore=E501
assert short_description in content assert short_description in content
@pytest.mark.skipif(os.name == 'nt', reason="Skip test on Windows")
@pytest.mark.regression('4400') @pytest.mark.regression('4400')
@pytest.mark.db @pytest.mark.db
def test_blacklist_implicits( def test_blacklist_implicits(
@ -369,6 +393,7 @@ def test_blacklist_implicits(
writer = writer_cls(item, 'default') writer = writer_cls(item, 'default')
assert writer.conf.blacklisted assert writer.conf.blacklisted
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
@pytest.mark.regression('9624') @pytest.mark.regression('9624')
@pytest.mark.db @pytest.mark.db
def test_autoload_with_constraints( def test_autoload_with_constraints(
@ -386,6 +411,7 @@ def test_autoload_with_constraints(
content = modulefile_content('mpileaks ^mpich') content = modulefile_content('mpileaks ^mpich')
assert len([x for x in content if 'is-loaded' in x]) == 0 assert len([x for x in content if 'is-loaded' in x]) == 0
@pytest.mark.skipif(sys.platform == 'win32', reason="All Fetchers Failed")
def test_config_backwards_compat(self, mutable_config): def test_config_backwards_compat(self, mutable_config):
settings = { settings = {
'enable': ['tcl'], 'enable': ['tcl'],

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os import os
import sys
import pytest import pytest
@ -135,6 +136,8 @@ def test_spack_monitor_without_auth(mock_monitor_request):
get_client(host="hostname") get_client(host="hostname")
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_spack_monitor_build_env(mock_monitor_request, install_mockery_mutable_config): def test_spack_monitor_build_env(mock_monitor_request, install_mockery_mutable_config):
monitor = get_client(host="hostname") monitor = get_client(host="hostname")
assert hasattr(monitor, "build_environment") assert hasattr(monitor, "build_environment")

View file

@ -3,6 +3,8 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import pytest import pytest
from spack.spec import Spec from spack.spec import Spec
@ -96,6 +98,8 @@ def test_normalize(spec_and_expected, config, mock_packages):
assert spec.eq_dag(expected, deptypes=False) assert spec.eq_dag(expected, deptypes=False)
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_default_variant(config, mock_packages): def test_default_variant(config, mock_packages):
spec = Spec('optional-dep-test-3') spec = Spec('optional-dep-test-3')
spec.concretize() spec.concretize()

View file

@ -3,7 +3,8 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os.path import posixpath
import sys
import pytest import pytest
@ -28,7 +29,7 @@ def test_package_name(self):
def test_package_filename(self): def test_package_filename(self):
repo = spack.repo.Repo(mock_packages_path) repo = spack.repo.Repo(mock_packages_path)
filename = repo.filename_for_package_name('mpich') filename = repo.filename_for_package_name('mpich')
assert filename == os.path.join( assert filename == posixpath.join(
mock_packages_path, mock_packages_path,
'packages', 'packages',
'mpich', 'mpich',
@ -38,7 +39,7 @@ def test_package_filename(self):
def test_nonexisting_package_filename(self): def test_nonexisting_package_filename(self):
repo = spack.repo.Repo(mock_packages_path) repo = spack.repo.Repo(mock_packages_path)
filename = repo.filename_for_package_name('some-nonexisting-package') filename = repo.filename_for_package_name('some-nonexisting-package')
assert filename == os.path.join( assert filename == posixpath.join(
mock_packages_path, mock_packages_path,
'packages', 'packages',
'some-nonexisting-package', 'some-nonexisting-package',
@ -63,6 +64,8 @@ def test_import_package_as(self):
import spack.pkg.builtin.mock.mpich as mp # noqa import spack.pkg.builtin.mock.mpich as mp # noqa
from spack.pkg.builtin import mock # noqa from spack.pkg.builtin import mock # noqa
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_inheritance_of_diretives(self): def test_inheritance_of_diretives(self):
p = spack.repo.get('simple-inheritance') p = spack.repo.get('simple-inheritance')
@ -88,12 +91,16 @@ def test_inheritance_of_diretives(self):
assert '~openblas' in s assert '~openblas' in s
assert 'mpi' in s assert 'mpi' in s
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.regression('11844') @pytest.mark.regression('11844')
def test_inheritance_of_patches(self): def test_inheritance_of_patches(self):
s = Spec('patch-inheritance') s = Spec('patch-inheritance')
# Will error if inheritor package cannot find inherited patch files # Will error if inheritor package cannot find inherited patch files
s.concretize() s.concretize()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_dependency_extensions(self): def test_dependency_extensions(self):
s = Spec('extension2') s = Spec('extension2')
s.concretize() s.concretize()
@ -118,6 +125,8 @@ def test_import_namespace_container_modules(self):
from spack.pkg.builtin import mock # noqa from spack.pkg.builtin import mock # noqa
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.regression('2737') @pytest.mark.regression('2737')
def test_urls_for_versions(mock_packages, config): def test_urls_for_versions(mock_packages, config):
"""Version directive without a 'url' argument should use default url.""" """Version directive without a 'url' argument should use default url."""
@ -142,6 +151,8 @@ def test_url_for_version_with_no_urls(mock_packages, config):
pkg.url_for_version('1.1') pkg.url_for_version('1.1')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_url_for_version_with_only_overrides(mock_packages, config): def test_url_for_version_with_only_overrides(mock_packages, config):
spec = Spec('url-only-override') spec = Spec('url-only-override')
spec.concretize() spec.concretize()
@ -160,6 +171,8 @@ def test_url_for_version_with_only_overrides(mock_packages, config):
assert pkg.url_for_version('0.7.0') == 'http://c.example.com/url_override-0.7.0.tar.gz' assert pkg.url_for_version('0.7.0') == 'http://c.example.com/url_override-0.7.0.tar.gz'
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_url_for_version_with_only_overrides_with_gaps(mock_packages, config): def test_url_for_version_with_only_overrides_with_gaps(mock_packages, config):
spec = Spec('url-only-override-with-gaps') spec = Spec('url-only-override-with-gaps')
spec.concretize() spec.concretize()
@ -327,6 +340,8 @@ def test_git_url_top_level_conflicts(mock_packages, config):
spack.fetch_strategy.for_package_version(pkg, '1.3') spack.fetch_strategy.for_package_version(pkg, '1.3')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_rpath_args(mutable_database): def test_rpath_args(mutable_database):
"""Test a package's rpath_args property.""" """Test a package's rpath_args property."""

View file

@ -12,6 +12,7 @@
import re import re
import shutil import shutil
import stat import stat
import sys
import pytest import pytest
@ -47,6 +48,8 @@ def fake_fetchify(url, pkg):
pkg.fetcher = fetcher pkg.fetcher = fetcher
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.usefixtures('install_mockery', 'mock_gnupghome') @pytest.mark.usefixtures('install_mockery', 'mock_gnupghome')
def test_buildcache(mock_archive, tmpdir): def test_buildcache(mock_archive, tmpdir):
# tweak patchelf to only do a download # tweak patchelf to only do a download
@ -189,6 +192,8 @@ def test_buildcache(mock_archive, tmpdir):
bindist._cached_specs = set() bindist._cached_specs = set()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
@pytest.mark.usefixtures('install_mockery') @pytest.mark.usefixtures('install_mockery')
def test_relocate_text(tmpdir): def test_relocate_text(tmpdir):
spec = Spec('trivial-install-test-package') spec = Spec('trivial-install-test-package')
@ -212,6 +217,8 @@ def test_relocate_text(tmpdir):
bindist._cached_specs = set() bindist._cached_specs = set()
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_relocate_links(tmpdir): def test_relocate_links(tmpdir):
with tmpdir.as_cwd(): with tmpdir.as_cwd():
old_layout_root = os.path.join( old_layout_root = os.path.join(
@ -253,6 +260,8 @@ def test_needs_relocation():
assert needs_binary_relocation('application', 'x-mach-binary') assert needs_binary_relocation('application', 'x-mach-binary')
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_replace_paths(tmpdir): def test_replace_paths(tmpdir):
with tmpdir.as_cwd(): with tmpdir.as_cwd():
suffix = 'dylib' if platform.system().lower() == 'darwin' else 'so' suffix = 'dylib' if platform.system().lower() == 'darwin' else 'so'
@ -462,6 +471,8 @@ def test_replace_paths(tmpdir):
} }
@pytest.mark.skipif(sys.platform == 'win32',
reason="Not supported on Windows (yet)")
def test_macho_make_paths(): def test_macho_make_paths():
out = macho_make_paths_relative('/Users/Shared/spack/pkgC/lib/libC.dylib', out = macho_make_paths_relative('/Users/Shared/spack/pkgC/lib/libC.dylib',
'/Users/Shared/spack', '/Users/Shared/spack',

Some files were not shown because too many files have changed in this diff Show more