diff options
Diffstat (limited to 'lib/spack/spack/test/multimethod.py')
-rw-r--r-- | lib/spack/spack/test/multimethod.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/spack/spack/test/multimethod.py b/lib/spack/spack/test/multimethod.py index 90948f010c..40519cccb1 100644 --- a/lib/spack/spack/test/multimethod.py +++ b/lib/spack/spack/test/multimethod.py @@ -1,13 +1,13 @@ ############################################################################## -# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. +# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # 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/llnl/spack -# Please also see the LICENSE file for our notice and the LGPL. +# 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 @@ -25,8 +25,7 @@ """Test for multi_method dispatch.""" import spack import pytest -from spack.multimethod import * -from spack.version import * +from spack.multimethod import NoSuchMethodError def test_no_version_match(builtin_mock): @@ -86,7 +85,7 @@ def test_default_works(builtin_mock): def test_target_match(builtin_mock): platform = spack.architecture.platform() - targets = platform.targets.values() + targets = list(platform.targets.values()) for target in targets[:-1]: pkg = spack.repo.get('multimethod target=' + target.name) assert pkg.different_by_target() == target.name @@ -118,3 +117,11 @@ def test_virtual_dep_match(builtin_mock): pkg = spack.repo.get('multimethod^mpich@1.0') assert pkg.different_by_virtual_dep() == 1 + + +def test_multimethod_with_base_class(builtin_mock): + pkg = spack.repo.get('multimethod@3') + assert pkg.base_method() == "subclass_method" + + pkg = spack.repo.get('multimethod@1') + assert pkg.base_method() == "base_method" |