Fixing multimethod test for new platforms

This commit is contained in:
Gregory Becker 2016-01-08 17:38:37 -08:00
parent 2b4dd8b9af
commit 2b2d4bae4e
2 changed files with 15 additions and 1 deletions

View File

@ -100,7 +100,11 @@ def test_target_match(self):
self.assertEqual(pkg.different_by_target(), target.name)
pkg = spack.db.get('multimethod='+targets[-1].name)
self.assertRaises(NoSuchMethodError, pkg.different_by_target)
if len(targets) == 1:
self.assertEqual(pkg.different_by_target(), targets[-1].name)
else:
self.assertRaises(NoSuchMethodError, pkg.different_by_target)
def test_dependency_match(self):
pkg = spack.db.get('multimethod^zmpi')

View File

@ -22,6 +22,9 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import imp
from llnl.util.filesystem import join_path
from spack.util.naming import mod_to_class
from spack import *
import spack.architecture
@ -103,8 +106,15 @@ def has_a_default(self):
#
# Make sure we can switch methods on different target
#
# for platform_name in ['cray_xc', 'darwin', 'linux']:
# file_path = join_path(spack.platform_path, platform_name)
# platform_mod = imp.load_source('spack.platforms', file_path + '.py')
# cls = getattr(platform_mod, mod_to_class(platform_name))
# platform = cls()
platform = spack.architecture.sys_type()
targets = platform.targets.values()
for target in targets[:-1]:
@when('='+target.name)
def different_by_target(self):