summaryrefslogtreecommitdiff
path: root/lib/spack/spack/test/multimethod.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/spack/spack/test/multimethod.py')
-rw-r--r--lib/spack/spack/test/multimethod.py50
1 files changed, 16 insertions, 34 deletions
diff --git a/lib/spack/spack/test/multimethod.py b/lib/spack/spack/test/multimethod.py
index 40519cccb1..de694c1498 100644
--- a/lib/spack/spack/test/multimethod.py
+++ b/lib/spack/spack/test/multimethod.py
@@ -1,40 +1,22 @@
-##############################################################################
-# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
-# Produced at the Lawrence Livermore National Laboratory.
+# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
-# This file is part of Spack.
-# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
-# LLNL-CODE-647188
-#
-# For details, see https://github.com/spack/spack
-# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License (as
-# published by the Free Software Foundation) version 2.1, February 1999.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
-# conditions of the GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-##############################################################################
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
"""Test for multi_method dispatch."""
-import spack
import pytest
+
+import spack.repo
from spack.multimethod import NoSuchMethodError
-def test_no_version_match(builtin_mock):
+def test_no_version_match(mock_packages):
pkg = spack.repo.get('multimethod@2.0')
with pytest.raises(NoSuchMethodError):
pkg.no_version_2()
-def test_one_version_match(builtin_mock):
+def test_one_version_match(mock_packages):
pkg = spack.repo.get('multimethod@1.0')
assert pkg.no_version_2() == 1
@@ -45,7 +27,7 @@ def test_one_version_match(builtin_mock):
assert pkg.no_version_2() == 4
-def test_version_overlap(builtin_mock):
+def test_version_overlap(mock_packages):
pkg = spack.repo.get('multimethod@2.0')
assert pkg.version_overlap() == 1
@@ -53,7 +35,7 @@ def test_version_overlap(builtin_mock):
assert pkg.version_overlap() == 2
-def test_mpi_version(builtin_mock):
+def test_mpi_version(mock_packages):
pkg = spack.repo.get('multimethod^mpich@3.0.4')
assert pkg.mpi_version() == 3
@@ -64,7 +46,7 @@ def test_mpi_version(builtin_mock):
assert pkg.mpi_version() == 1
-def test_undefined_mpi_version(builtin_mock):
+def test_undefined_mpi_version(mock_packages):
pkg = spack.repo.get('multimethod^mpich@0.4')
assert pkg.mpi_version() == 1
@@ -72,7 +54,7 @@ def test_undefined_mpi_version(builtin_mock):
assert pkg.mpi_version() == 1
-def test_default_works(builtin_mock):
+def test_default_works(mock_packages):
pkg = spack.repo.get('multimethod%gcc')
assert pkg.has_a_default() == 'gcc'
@@ -83,7 +65,7 @@ def test_default_works(builtin_mock):
assert pkg.has_a_default() == 'default'
-def test_target_match(builtin_mock):
+def test_target_match(mock_packages):
platform = spack.architecture.platform()
targets = list(platform.targets.values())
for target in targets[:-1]:
@@ -98,7 +80,7 @@ def test_target_match(builtin_mock):
pkg.different_by_target()
-def test_dependency_match(builtin_mock):
+def test_dependency_match(mock_packages):
pkg = spack.repo.get('multimethod^zmpi')
assert pkg.different_by_dep() == 'zmpi'
@@ -111,7 +93,7 @@ def test_dependency_match(builtin_mock):
assert pkg.different_by_dep() == 'mpich'
-def test_virtual_dep_match(builtin_mock):
+def test_virtual_dep_match(mock_packages):
pkg = spack.repo.get('multimethod^mpich2')
assert pkg.different_by_virtual_dep() == 2
@@ -119,7 +101,7 @@ def test_virtual_dep_match(builtin_mock):
assert pkg.different_by_virtual_dep() == 1
-def test_multimethod_with_base_class(builtin_mock):
+def test_multimethod_with_base_class(mock_packages):
pkg = spack.repo.get('multimethod@3')
assert pkg.base_method() == "subclass_method"