Skip to content

Commit

Permalink
Fix test failure due to unresolved template
Browse files Browse the repository at this point in the history
Fixes e.g.
  File "test/easyconfigs/easyconfigs.py", line 1047, in test_r_libs_site_env_var
  if 'R_LIBS' in ec['ec'][key]:
  ...
easybuild.tools.build_log.EasyBuildError: 'Failed to resolve all templates in "/path/to/AlphaFold_DBs/%(versions)s" using template dictionary

Similar for other changes
  • Loading branch information
Flamefire committed Dec 19, 2024
1 parent 8b4fd4f commit aa59f02
Showing 1 changed file with 25 additions and 30 deletions.
55 changes: 25 additions & 30 deletions test/easyconfigs/easyconfigs.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,37 +988,32 @@ def test_downloadable_or_instructions(self):
]:
continue

if (('download_instructions' in ec and ec['download_instructions']) or ('crates' in ec and ec['crates']) or
('channels' in ec and ec['channels']) or ('source_urls' in ec and ec['source_urls'])):
continue

ok = False
for source in ec['sources']:
if isinstance(source, dict):
if 'git_config' in source:
ok = True
break
if 'source_urls' in source:
ok = True
break
with ec.disable_templating():
if ec.get('download_instructions') or ec.get('crates') or ec.get('channels') or ec.get('source_urls'):
continue

for ext in ec['exts_list']:
if isinstance(ext, tuple) and len(ext) >= 3:
if 'source_urls' in ext[2]:
ok = True
break
ok = False
for source in ec['sources']:
if isinstance(source, dict):
if 'git_config' in source or 'source_urls' in source:
ok = True
break

if 'components' in ec and ec['components']:
for component in ec['components']:
if len(component) > 2 and not isinstance(component[2], str):
if 'source_urls' in component[2]:
for ext in ec['exts_list']:
if isinstance(ext, tuple) and len(ext) >= 3:
if 'source_urls' in ext[2]:
ok = True
break

if ok:
continue
if 'components' in ec and ec['components']:
for component in ec['components']:
if len(component) > 2 and not isinstance(component[2], str):
if 'source_urls' in component[2]:
ok = True
break

problem_ecs.append(easyconfig['spec'])
if not ok:
problem_ecs.append(easyconfig['spec'])

error_msg = "%d easyconfigs found without defined sources or download_instructions: %s"
self.assertEqual(problem_ecs, [], error_msg % (len(problem_ecs), ', '.join(problem_ecs)))
Expand All @@ -1027,7 +1022,7 @@ def test_sanity_check_paths(self):
"""Make sure specified sanity check paths adher to the requirements."""

for ec in self.parsed_easyconfigs:
ec_scp = ec['ec'].get_ref('sanity_check_paths')
ec_scp = ec['ec'].get('sanity_check_paths', resolve=False)
if ec_scp != {}:
# if sanity_check_paths is specified (i.e., non-default), it must adher to the requirements
# both 'files' and 'dirs' keys, both with list values and with at least one a non-empty list
Expand All @@ -1043,9 +1038,8 @@ def test_r_libs_site_env_var(self):

r_libs_ecs = []
for ec in self.parsed_easyconfigs:
for key in ('modextrapaths', 'modextravars'):
if 'R_LIBS' in ec['ec'].get_ref(key):
r_libs_ecs.append(ec['spec'])
if any('R_LIBS' in ec['ec'].get(key, resolve=False) for key in ('modextrapaths', 'modextravars')):
r_libs_ecs.append(ec['spec'])

error_msg = "%d easyconfigs found which set $R_LIBS, should be $R_LIBS_SITE: %s"
self.assertEqual(r_libs_ecs, [], error_msg % (len(r_libs_ecs), ', '.join(r_libs_ecs)))
Expand Down Expand Up @@ -1708,6 +1702,7 @@ def template_easyconfig_test(self, spec):
dummy_template_values = {
'builddir': '/dummy/builddir',
'installdir': '/dummy/installdir',
'startdir': '/dummy/startdir',
'parallel': '2',
}
ec.template_values.update(dummy_template_values)
Expand Down Expand Up @@ -1815,7 +1810,7 @@ def template_easyconfig_test(self, spec):

# meson buildtype should be specified with easyblock parameter "buildtype" not with custom configopts.
if ec['easyblock'] == 'MesonNinja':
configopts = ec.get('configopts', '', resolve=True)
configopts = ec.get('configopts', '', resolve=False)
if '--buildtype ' in configopts or '--buildtype=' in configopts:
fail_msg = "Build type should be specified via MesonNinja parameter 'buildtype' instead of configopts."
failing_checks.append(fail_msg)
Expand Down

0 comments on commit aa59f02

Please sign in to comment.