def test_extensions_sanity_check(self): """Test sanity check aspect of extensions.""" test_ecs_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'easyconfigs', 'test_ecs') toy_ec = EasyConfig(os.path.join(test_ecs_dir, 't', 'toy', 'toy-0.0-gompi-1.3.12-test.eb')) # purposely put sanity check command in place that breaks the build, # to check whether sanity check is only run once; # sanity check commands are checked after checking sanity check paths, so this should work toy_ec.update('sanity_check_commands', [("%(installdir)s/bin/toy && rm %(installdir)s/bin/toy", '')]) # this import only works here, since EB_toy is a test easyblock from easybuild.easyblocks.toy import EB_toy eb = EB_toy(toy_ec) eb.silent = True eb.run_all_steps(True)
def test_extensions_sanity_check(self): """Test sanity check aspect of extensions.""" test_ecs_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'easyconfigs', 'test_ecs') toy_ec = EasyConfig(os.path.join(test_ecs_dir, 't', 'toy', 'toy-0.0-gompi-1.3.12-test.eb')) # purposely put sanity check command in place that breaks the build, # to check whether sanity check is only run once; # sanity check commands are checked after checking sanity check paths, so this should work toy_ec.update('sanity_check_commands', [("%(installdir)s/bin/toy && rm %(installdir)s/bin/toy", '')]) # this import only works here, since EB_toy is a test easyblock from easybuild.easyblocks.toy import EB_toy eb = EB_toy(toy_ec) eb.silent = True eb.run_all_steps(True)
def test_update(self): """Test use of update() method for EasyConfig instances.""" toy_ebfile = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'easyconfigs', 'toy-0.0.eb') ec = EasyConfig(toy_ebfile) # for string values: append ec.update('unpack_options', '--strip-components=1') self.assertEqual(ec['unpack_options'].strip(), '--strip-components=1') ec.update('description', "- just a test") self.assertEqual(ec['description'].strip(), "Toy C program. - just a test") # spaces in between multiple updates for stirng values ec.update('configopts', 'CC="$CC"') ec.update('configopts', 'CXX="$CXX"') self.assertTrue(ec['configopts'].strip().endswith('CC="$CC" CXX="$CXX"')) # for list values: extend ec.update('patches', ['foo.patch', 'bar.patch']) self.assertEqual(ec['patches'], ['toy-0.0_typo.patch', 'foo.patch', 'bar.patch'])