@@ -3576,19 +3576,6 @@ def test_det_subtoolchain_version(self):
35763576 for subtoolchain_name in subtoolchains [current_tc ['name' ]]]
35773577 self .assertEqual (versions , [None , '' ])
35783578
3579- # --add-dummy-to-minimal-toolchains is still supported, but deprecated
3580- self .allow_deprecated_behaviour ()
3581- init_config (build_options = {'add_system_to_minimal_toolchains' : False , 'add_dummy_to_minimal_toolchains' : True })
3582- self .mock_stderr (True )
3583- versions = [det_subtoolchain_version (current_tc , subtoolchain_name , optional_toolchains , cands )
3584- for subtoolchain_name in subtoolchains [current_tc ['name' ]]]
3585- stderr = self .get_stderr ()
3586- self .mock_stderr (False )
3587- self .assertEqual (versions , [None , '' ])
3588- depr_msg = "WARNING: Deprecated functionality, will no longer work in v5.0: "
3589- depr_msg += "Use --add-system-to-minimal-toolchains instead of --add-dummy-to-minimal-toolchains"
3590- self .assertIn (depr_msg , stderr )
3591-
35923579 # and GCCcore if existing too
35933580 init_config (build_options = {'add_system_to_minimal_toolchains' : True })
35943581 current_tc = {'name' : 'GCC' , 'version' : '4.9.3-2.25' }
@@ -4130,9 +4117,6 @@ def test_fix_deprecated_easyconfigs(self):
41304117 """Test fix_deprecated_easyconfigs function."""
41314118 test_ecs_dir = os .path .join (os .path .dirname (os .path .abspath (__file__ )), 'easyconfigs' , 'test_ecs' )
41324119 toy_ec = os .path .join (test_ecs_dir , 't' , 'toy' , 'toy-0.0.eb' )
4133- gzip_ec = os .path .join (test_ecs_dir , 'g' , 'gzip' , 'gzip-1.4.eb' )
4134-
4135- gzip_ec_txt = read_file (gzip_ec )
41364120 toy_ec_txt = read_file (toy_ec )
41374121
41384122 test_ec = os .path .join (self .test_prefix , 'test.eb' )
@@ -4149,115 +4133,42 @@ def test_fix_deprecated_easyconfigs(self):
41494133 regex = re .compile (r'^(toolchain\s*=.*)$' , re .M )
41504134 test_ectxt = regex .sub (r'\1\n\nsome_list = [x + "1" for x in ["one", "two", "three"]]' , test_ectxt )
41514135
4152- # test fixing the use of 'dummy' toolchain to SYSTEM
4153- tc_regex = re .compile ('^toolchain = .*' , re .M )
4154- tc_strs = [
4155- "{'name': 'dummy', 'version': 'dummy'}" ,
4156- "{'name': 'dummy', 'version': ''}" ,
4157- "{'name': 'dummy', 'version': '1.2.3'}" ,
4158- "{'version': '', 'name': 'dummy'}" ,
4159- "{'version': 'dummy', 'name': 'dummy'}" ,
4160- ]
4161-
41624136 unknown_params_error_pattern = "Use of 2 unknown easyconfig parameters detected in test.eb: foo, some_list"
41634137
4164- for tc_str in tc_strs :
4165- # first check if names of local variables get fixed if 'dummy' toolchain is not used
4166- init_config (build_options = {'local_var_naming_check' : 'error' , 'silent' : True })
4167-
4168- write_file (test_ec , test_ectxt )
4169- self .assertErrorRegex (EasyBuildError , unknown_params_error_pattern , EasyConfig , test_ec )
4170-
4171- self .mock_stderr (True )
4172- self .mock_stdout (True )
4173- fix_deprecated_easyconfigs ([test_ec ])
4174- stderr , stdout = self .get_stderr (), self .get_stdout ()
4175- self .mock_stderr (False )
4176- self .mock_stdout (False )
4177- self .assertFalse (stderr )
4178- self .assertIn ("test.eb... FIXED!" , stdout )
4179-
4180- # parsing now works
4181- ec = EasyConfig (test_ec )
4182-
4183- # cleanup
4184- remove_file (glob .glob (os .path .join (test_ec + '.orig*' ))[0 ])
4185-
4186- # now inject use of 'dummy' toolchain
4187- write_file (test_ec , tc_regex .sub ("toolchain = %s" % tc_str , test_ectxt ))
4188-
4189- test_ec_txt = read_file (test_ec )
4190- regex = re .compile ("^toolchain = {.*'name': 'dummy'.*$" , re .M )
4191- self .assertTrue (regex .search (test_ec_txt ), "Pattern '%s' found in: %s" % (regex .pattern , test_ec_txt ))
4192-
4193- # mimic default behaviour where only warnings are being printed;
4194- # use of dummy toolchain or local variables not following recommended naming scheme is not fatal by default
4195- init_config (build_options = {'local_var_naming_check' : 'warn' , 'silent' : False })
4196- self .mock_stderr (True )
4197- self .mock_stdout (True )
4198- ec = EasyConfig (test_ec )
4199- stderr , stdout = self .get_stderr (), self .get_stdout ()
4200- self .mock_stderr (False )
4201- self .mock_stdout (False )
4202-
4203- self .assertFalse (stdout )
4204-
4205- warnings = [
4206- "WARNING: Use of 2 unknown easyconfig parameters detected in test.eb: foo, some_list" ,
4207- "Use of 'dummy' toolchain is deprecated, use 'system' toolchain instead" ,
4208- ]
4209- for warning in warnings :
4210- self .assertIn (warning , stderr )
4211-
4212- init_config (build_options = {'local_var_naming_check' : 'error' , 'silent' : True })
4213-
4214- # easyconfig doesn't parse because of local variables with name other than 'local_*'
4215- self .assertErrorRegex (EasyBuildError , unknown_params_error_pattern , EasyConfig , test_ec )
4216-
4217- self .mock_stderr (True )
4218- self .mock_stdout (True )
4219- fix_deprecated_easyconfigs ([toy_ec , test_ec , gzip_ec ])
4220- stderr , stdout = self .get_stderr (), self .get_stdout ()
4221- self .mock_stderr (False )
4222- self .mock_stdout (False )
4223-
4224- ectxt = read_file (test_ec )
4225- self .assertFalse (regex .search (ectxt ), "Pattern '%s' *not* found in: %s" % (regex .pattern , ectxt ))
4226- regex = re .compile ("^toolchain = SYSTEM$" , re .M )
4227- self .assertTrue (regex .search (ectxt ), "Pattern '%s' found in: %s" % (regex .pattern , ectxt ))
4228-
4229- self .assertEqual (gzip_ec_txt , read_file (gzip_ec ))
4230- self .assertEqual (toy_ec_txt , read_file (toy_ec ))
4231- self .assertTrue (test_ec_txt != read_file (test_ec ))
4138+ # check if names of local variables get fixed
4139+ init_config (build_options = {'local_var_naming_check' : 'error' , 'silent' : True })
42324140
4233- # original easyconfig is backed up automatically
4234- test_ecs = sorted ([f for f in os .listdir (self .test_prefix ) if f .startswith ('test.eb' )])
4235- self .assertEqual (len (test_ecs ), 2 )
4236- backup_test_ec = os .path .join (self .test_prefix , test_ecs [1 ])
4237- self .assertEqual (test_ec_txt , read_file (backup_test_ec ))
4141+ write_file (test_ec , test_ectxt )
4142+ self .assertErrorRegex (EasyBuildError , unknown_params_error_pattern , EasyConfig , test_ec )
42384143
4239- remove_file (backup_test_ec )
4144+ self .mock_stderr (True )
4145+ self .mock_stdout (True )
4146+ fix_deprecated_easyconfigs ([test_ec ])
4147+ stderr , stdout = self .get_stderr (), self .get_stdout ()
4148+ self .mock_stderr (False )
4149+ self .mock_stdout (False )
4150+ self .assertFalse (stderr )
4151+ self .assertIn ("test.eb... FIXED!" , stdout )
42404152
4241- # parsing works now, toolchain is replaced with system toolchain
4242- ec = EasyConfig (test_ec )
4243- self .assertEqual (ec ['toolchain' ], {'name' : 'system' , 'version' : 'system' })
4244- self .assertEqual (ec ['configopts' ], "--foobar --barfoo --barfoobaz" )
4153+ # parsing now works
4154+ ec = EasyConfig (test_ec )
4155+ self .assertEqual (ec ['configopts' ], "--foobar --barfoo --barfoobaz" )
4156+ self .assertFalse (stderr )
4157+ stdout = stdout .split ('\n ' )
4158+ self .assertEqual (len (stdout ), 6 )
4159+ patterns = [
4160+ r"^\* \[1/1\] fixing .*/test.eb\.\.\. FIXED!$" ,
4161+ r"^\s*\(changes made in place, original copied to .*/test.eb.orig_[0-9_]+\)$" ,
4162+ r'^$' ,
4163+ r"^All done! Fixed 1 easyconfigs \(out of 1 found\).$" ,
4164+ r'^$' ,
4165+ r'^$' ,
4166+ ]
4167+ for idx , pattern in enumerate (patterns ):
4168+ self .assertTrue (re .match (pattern , stdout [idx ]), "Pattern '%s' matches '%s'" % (pattern , stdout [idx ]))
42454169
4246- self .assertFalse (stderr )
4247- stdout = stdout .split ('\n ' )
4248- self .assertEqual (len (stdout ), 8 )
4249- patterns = [
4250- r"^\* \[1/3\] fixing .*/t/toy/toy-0.0.eb\.\.\. \(no changes made\)$" ,
4251- r"^\* \[2/3\] fixing .*/test.eb\.\.\. FIXED!$" ,
4252- r"^\s*\(changes made in place, original copied to .*/test.eb.orig_[0-9_]+\)$" ,
4253- r"^\* \[3/3\] fixing .*/g/gzip/gzip-1.4.eb\.\.\. \(no changes made\)$" ,
4254- r'^$' ,
4255- r"^All done! Fixed 1 easyconfigs \(out of 3 found\).$" ,
4256- r'^$' ,
4257- r'^$' ,
4258- ]
4259- for idx , pattern in enumerate (patterns ):
4260- self .assertTrue (re .match (pattern , stdout [idx ]), "Pattern '%s' matches '%s'" % (pattern , stdout [idx ]))
4170+ # cleanup
4171+ remove_file (glob .glob (os .path .join (test_ec + '.orig*' ))[0 ])
42614172
42624173 def test_parse_list_comprehension_scope (self ):
42634174 """Test parsing of an easyconfig file that uses a local variable in list comprehension."""
0 commit comments