From 7e9baf9e2533eb040aa142bd3bf6ffbd142516ac Mon Sep 17 00:00:00 2001 From: Gregory Becker Date: Tue, 29 Mar 2016 11:23:36 -0700 Subject: [PATCH] Made architecture test robust for more architectures --- lib/spack/spack/test/architecture.py | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/lib/spack/spack/test/architecture.py b/lib/spack/spack/test/architecture.py index 75a67bf02f..2274a9901d 100644 --- a/lib/spack/spack/test/architecture.py +++ b/lib/spack/spack/test/architecture.py @@ -13,32 +13,26 @@ from spack.platforms.darwin import Darwin class ArchitectureTest(unittest.TestCase): - - def test_to_dict_function_with_architecture(self): + + def test_dict_functions_for_architecture(self): arch = Arch() arch.platform_os = arch.platform.operating_system('default_os') arch.target = arch.platform.target('default') d = arch.to_dict() - self.assertEqual(d, {'platform' : 'crayxc', - 'platform_os' : {'name': 'CNL', - 'compiler_strategy' : 'MODULES', - 'version':'10'}, - 'target' : {'name': 'haswell', - 'module_name': 'craype-haswell'}}) - - def test_from_dict_function_with_architecture(self): - d = {'platform':'crayxc', - 'platform_os' : {'name' : 'CNL', 'compiler_strategy': 'MODULES', - 'version': '10'}, - 'target' : {'name':'haswell', 'module_name': 'craype-haswell'}} - - arch = spack.architecture.arch_from_dict(d) + + new_arch = spack.architecture.arch_from_dict(d) + self.assertEqual(arch, new_arch) + self.assertTrue( isinstance(arch, Arch) ) self.assertTrue( isinstance(arch.platform, Platform) ) self.assertTrue( isinstance(arch.platform_os, OperatingSystem) ) self.assertTrue( isinstance(arch.target, Target) ) - + self.assertTrue( isinstance(new_arch, Arch) ) + self.assertTrue( isinstance(new_arch.platform, Platform) ) + self.assertTrue( isinstance(new_arch.platform_os, OperatingSystem) ) + self.assertTrue( isinstance(new_arch.target, Target) ) + def test_platform_class_and_compiler_strategies(self): a = CrayXc()