@@ -1289,6 +1289,7 @@ def test_ec_method_resolve_template(self):
12891289 homepage = "http://example.com"
12901290 description = "test easyconfig %(name)s version %(version_major)s"
12911291 toolchain = SYSTEM
1292+ installopts = "PREFIX=%(installdir)s"
12921293 """ )
12931294 self .prep ()
12941295 ec = EasyConfig (self .eb_file , validate = False )
@@ -1302,6 +1303,22 @@ def test_ec_method_resolve_template(self):
13021303 self .assertIn ('%' , description , 'Description needs a template for the next test' )
13031304 self .assertEqual (ec .resolve_template (description ), ec ['description' ])
13041305
1306+ val = "PREFIX=%(installdir)s"
1307+
1308+ # by default unresolved template value triggers an error being raised
1309+ error_pattern = "Failed to resolve all templates"
1310+ self .assertErrorRegex (EasyBuildError , error_pattern , ec .resolve_template , val )
1311+ self .assertErrorRegex (EasyBuildError , error_pattern , ec .get , 'installopts' )
1312+
1313+ # this can be (temporarily) disabled via expect_resolved_template_values in EasyConfig instance
1314+ ec .expect_resolved_template_values = False
1315+ self .assertEqual (ec .resolve_template (val ), val )
1316+ self .assertEqual (ec ['installopts' ], val )
1317+
1318+ ec .expect_resolved_template_values = True
1319+ self .assertErrorRegex (EasyBuildError , error_pattern , ec .resolve_template , val )
1320+ self .assertErrorRegex (EasyBuildError , error_pattern , ec .get , 'installopts' )
1321+
13051322 def test_templating_cuda_toolchain (self ):
13061323 """Test templates via toolchain component, like setting %(cudaver)s with fosscuda toolchain."""
13071324
0 commit comments