@@ -1289,6 +1289,7 @@ def test_ec_method_resolve_template(self):
1289
1289
homepage = "http://example.com"
1290
1290
description = "test easyconfig %(name)s version %(version_major)s"
1291
1291
toolchain = SYSTEM
1292
+ installopts = "PREFIX=%(installdir)s"
1292
1293
""" )
1293
1294
self .prep ()
1294
1295
ec = EasyConfig (self .eb_file , validate = False )
@@ -1302,6 +1303,22 @@ def test_ec_method_resolve_template(self):
1302
1303
self .assertIn ('%' , description , 'Description needs a template for the next test' )
1303
1304
self .assertEqual (ec .resolve_template (description ), ec ['description' ])
1304
1305
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
+
1305
1322
def test_templating_cuda_toolchain (self ):
1306
1323
"""Test templates via toolchain component, like setting %(cudaver)s with fosscuda toolchain."""
1307
1324
0 commit comments