4444from easybuild .base import fancylogger
4545from easybuild .framework .easyblock import EasyBlock , get_easyblock_instance
4646from easybuild .framework .easyconfig import CUSTOM
47- from easybuild .framework .easyconfig .easyconfig import EasyConfig
47+ from easybuild .framework .easyconfig .easyconfig import EasyConfig , ITERATE_OPTIONS
4848from easybuild .framework .easyconfig .tools import avail_easyblocks , process_easyconfig
4949from easybuild .framework .extensioneasyblock import ExtensionEasyBlock
5050from easybuild .tools import LooseVersion , config
@@ -1173,7 +1173,9 @@ def test_handle_iterate_opts(self):
11731173 self .assertEqual (eb .cfg .iterate_options , [])
11741174 self .assertEqual (eb .cfg ['configopts' ], ["--opt1 --anotheropt" , "--opt2" , "--opt3 --optbis" ])
11751175
1176- expected_iter_opts = {'configopts' : ["--opt1 --anotheropt" , "--opt2" , "--opt3 --optbis" ]}
1176+ expected_iter_opts = dict .fromkeys (ITERATE_OPTIONS , "" )
1177+ expected_iter_opts ['builddependencies' ] = []
1178+ expected_iter_opts ['configopts' ] = ["--opt1 --anotheropt" , "--opt2" , "--opt3 --optbis" ]
11771179
11781180 # once iteration mode is set, we're still in iteration #0
11791181 self .mock_stdout (True )
@@ -1185,6 +1187,8 @@ def test_handle_iterate_opts(self):
11851187 self .assertEqual (eb .cfg .iterating , True )
11861188 self .assertEqual (eb .cfg .iterate_options , ['configopts' ])
11871189 self .assertEqual (eb .cfg ['configopts' ], "--opt1 --anotheropt" )
1190+ # mimic easyblock that changes this in-place
1191+ eb .cfg ['preconfigopts' ] = "FOO=bar "
11881192 self .assertEqual (eb .iter_opts , expected_iter_opts )
11891193
11901194 # when next iteration is start, iteration index gets bumped
@@ -1196,6 +1200,8 @@ def test_handle_iterate_opts(self):
11961200 self .assertEqual (stdout , "== starting iteration #1 ...\n " )
11971201 self .assertEqual (eb .cfg .iterating , True )
11981202 self .assertEqual (eb .cfg .iterate_options , ['configopts' ])
1203+ # preconfigopts should have been restored (https://github.com/easybuilders/easybuild-framework/pull/4848)
1204+ self .assertEqual (eb .cfg ['preconfigopts' ], "" )
11991205 self .assertEqual (eb .cfg ['configopts' ], "--opt2" )
12001206 self .assertEqual (eb .iter_opts , expected_iter_opts )
12011207
0 commit comments