def test_format_equivalence_basic(self): """Test whether easyconfigs in different formats are equivalent.""" # hard enable experimental orig_experimental = easybuild.tools.build_log.EXPERIMENTAL easybuild.tools.build_log.EXPERIMENTAL = True easyconfigs_path = os.path.join(os.path.dirname(__file__), 'easyconfigs') # set max diff high enough to make sure the difference is shown in case of problems self.maxDiff = 10000 for eb_file1, eb_file2, specs in [ ('gzip-1.4.eb', 'gzip.eb', {}), ('gzip-1.4.eb', 'gzip.eb', {'version': '1.4'}), ('gzip-1.4.eb', 'gzip.eb', {'version': '1.4', 'toolchain': {'name': 'dummy', 'version': 'dummy'}}), ('gzip-1.4-GCC-4.6.3.eb', 'gzip.eb', {'version': '1.4', 'toolchain': {'name': 'GCC', 'version': '4.6.3'}}), ('gzip-1.5-goolf-1.4.10.eb', 'gzip.eb', {'version': '1.5', 'toolchain': {'name': 'goolf', 'version': '1.4.10'}}), ('gzip-1.5-ictce-4.1.13.eb', 'gzip.eb', {'version': '1.5', 'toolchain': {'name': 'ictce', 'version': '4.1.13'}}), ]: ec1 = EasyConfig(os.path.join(easyconfigs_path, 'v1.0', eb_file1), validate=False) ec2 = EasyConfig(os.path.join(easyconfigs_path, 'v2.0', eb_file2), validate=False, build_specs=specs) ec2_dict = ec2.asdict() # reset mandatory attributes from format2 that are not in format 1 for attr in ['docurls', 'software_license', 'software_license_urls']: ec2_dict[attr] = None self.assertEqual(ec1.asdict(), ec2_dict) # restore easybuild.tools.build_log.EXPERIMENTAL = orig_experimental
def test_format_equivalence_basic(self): """Test whether easyconfigs in different formats are equivalent.""" # hard enable experimental orig_experimental = easybuild.tools.build_log.EXPERIMENTAL easybuild.tools.build_log.EXPERIMENTAL = True easyconfigs_path = os.path.join(os.path.dirname(__file__), 'easyconfigs') # set max diff high enough to make sure the difference is shown in case of problems self.maxDiff = 10000 build_options = { 'valid_stops': self.all_stops, 'validate': False, } for eb_file1, eb_file2, specs in [ ('gzip-1.4.eb', 'gzip.eb', {}), ('gzip-1.4.eb', 'gzip.eb', {'version': '1.4'}), ('gzip-1.4.eb', 'gzip.eb', {'version': '1.4', 'toolchain': {'name': 'dummy', 'version': 'dummy'}}), ('gzip-1.4-GCC-4.6.3.eb', 'gzip.eb', {'version': '1.4', 'toolchain': {'name': 'GCC', 'version': '4.6.3'}}), ('gzip-1.5-goolf-1.4.10.eb', 'gzip.eb', {'version': '1.5', 'toolchain': {'name': 'goolf', 'version': '1.4.10'}}), ('gzip-1.5-ictce-4.1.13.eb', 'gzip.eb', {'version': '1.5', 'toolchain': {'name': 'ictce', 'version': '4.1.13'}}), ]: ec1 = EasyConfig(os.path.join(easyconfigs_path, 'v1.0', eb_file1), build_options=build_options) ec2 = EasyConfig(os.path.join(easyconfigs_path, 'v2.0', eb_file2), build_options=build_options, build_specs=specs) self.assertEqual(ec1.asdict(), ec2.asdict()) # restore easybuild.tools.build_log.EXPERIMENTAL = orig_experimental
def test_parse_yeb(self): """Test parsing of .yeb easyconfigs.""" if 'yaml' not in sys.modules: print "Skipping test_parse_yeb (no PyYAML available)" return testdir = os.path.dirname(os.path.abspath(__file__)) test_easyconfigs = os.path.join(testdir, 'easyconfigs') test_yeb_easyconfigs = os.path.join(testdir, 'easyconfigs', 'yeb') # test parsing test_files = [ 'bzip2-1.0.6-GCC-4.9.2', 'gzip-1.6-GCC-4.9.2', 'goolf-1.4.10', 'ictce-4.1.13', 'SQLite-3.8.10.2-goolf-1.4.10', 'Python-2.7.10-ictce-4.1.13', 'CrayCCE-5.1.29', ] for filename in test_files: ec_yeb = EasyConfig(os.path.join(test_yeb_easyconfigs, '%s.yeb' % filename)) # compare with parsed result of .eb easyconfig ec_eb = EasyConfig(os.path.join(test_easyconfigs, '%s.eb' % filename)) no_match = False for key in sorted(ec_yeb.asdict()): eb_val = ec_eb[key] yeb_val = ec_yeb[key] if key == 'description': # multi-line string is always terminated with '\n' in YAML, so strip it off yeb_val = yeb_val.strip() self.assertEqual(yeb_val, eb_val)
def test_parse_yeb(self): """Test parsing of .yeb easyconfigs.""" if 'yaml' not in sys.modules: print "Skipping test_parse_yeb (no PyYAML available)" return build_options = { 'check_osdeps': False, 'external_modules_metadata': {}, 'valid_module_classes': module_classes(), } init_config(build_options=build_options) easybuild.tools.build_log.EXPERIMENTAL = True testdir = os.path.dirname(os.path.abspath(__file__)) test_easyconfigs = os.path.join(testdir, 'easyconfigs') test_yeb_easyconfigs = os.path.join(testdir, 'easyconfigs', 'yeb') # test parsing test_files = [ 'bzip2-1.0.6-GCC-4.9.2', 'gzip-1.6-GCC-4.9.2', 'goolf-1.4.10', 'ictce-4.1.13', 'SQLite-3.8.10.2-goolf-1.4.10', 'Python-2.7.10-ictce-4.1.13', 'CrayCCE-5.1.29', 'toy-0.0', ] for filename in test_files: ec_yeb = EasyConfig( os.path.join(test_yeb_easyconfigs, '%s.yeb' % filename)) # compare with parsed result of .eb easyconfig ec_file = glob.glob( os.path.join(test_easyconfigs, 'test_ecs', '*', '*', '%s.eb' % filename))[0] ec_eb = EasyConfig(ec_file) no_match = False for key in sorted(ec_yeb.asdict()): eb_val = ec_eb[key] yeb_val = ec_yeb[key] if key == 'description': # multi-line string is always terminated with '\n' in YAML, so strip it off yeb_val = yeb_val.strip() self.assertEqual(yeb_val, eb_val)
def test_parse_yeb(self): """Test parsing of .yeb easyconfigs.""" if 'yaml' not in sys.modules: print "Skipping test_parse_yeb (no PyYAML available)" return build_options = { 'check_osdeps': False, 'external_modules_metadata': {}, 'valid_module_classes': module_classes(), } init_config(build_options=build_options) easybuild.tools.build_log.EXPERIMENTAL = True testdir = os.path.dirname(os.path.abspath(__file__)) test_easyconfigs = os.path.join(testdir, 'easyconfigs') test_yeb_easyconfigs = os.path.join(testdir, 'easyconfigs', 'yeb') # test parsing test_files = [ 'bzip2-1.0.6-GCC-4.9.2', 'gzip-1.6-GCC-4.9.2', 'goolf-1.4.10', 'ictce-4.1.13', 'SQLite-3.8.10.2-goolf-1.4.10', 'Python-2.7.10-ictce-4.1.13', 'CrayCCE-5.1.29', 'toy-0.0', ] for filename in test_files: ec_yeb = EasyConfig(os.path.join(test_yeb_easyconfigs, '%s.yeb' % filename)) # compare with parsed result of .eb easyconfig ec_file = glob.glob(os.path.join(test_easyconfigs, 'test_ecs', '*', '*', '%s.eb' % filename))[0] ec_eb = EasyConfig(ec_file) no_match = False for key in sorted(ec_yeb.asdict()): eb_val = ec_eb[key] yeb_val = ec_yeb[key] if key == 'description': # multi-line string is always terminated with '\n' in YAML, so strip it off yeb_val = yeb_val.strip() self.assertEqual(yeb_val, eb_val)