@@ -2182,118 +2182,71 @@ def test_parallel(self):
2182
2182
toy_ec = os .path .join (topdir , 'easyconfigs' , 'test_ecs' , 't' , 'toy' , 'toy-0.0.eb' )
2183
2183
toytxt = read_file (toy_ec )
2184
2184
2185
+ handle , toy_ec_error = tempfile .mkstemp (prefix = 'easyblock_test_file_' , suffix = '.eb' )
2186
+ os .close (handle )
2187
+ write_file (toy_ec_error , toytxt + "\n parallel = 123" )
2188
+
2185
2189
handle , toy_ec1 = tempfile .mkstemp (prefix = 'easyblock_test_file_' , suffix = '.eb' )
2186
2190
os .close (handle )
2187
- write_file (toy_ec1 , toytxt + "\n parallel = 123 " )
2191
+ write_file (toy_ec1 , toytxt + "\n maxparallel = None " )
2188
2192
2189
2193
handle , toy_ec2 = tempfile .mkstemp (prefix = 'easyblock_test_file_' , suffix = '.eb' )
2190
2194
os .close (handle )
2191
- write_file (toy_ec2 , toytxt + "\n parallel = 123 \ n maxparallel = 67" )
2195
+ write_file (toy_ec2 , toytxt + "\n maxparallel = 67" )
2192
2196
2193
2197
handle , toy_ec3 = tempfile .mkstemp (prefix = 'easyblock_test_file_' , suffix = '.eb' )
2194
2198
os .close (handle )
2195
- write_file (toy_ec3 , toytxt + "\n parallel = False" )
2196
-
2197
- handle , toy_ec4 = tempfile .mkstemp (prefix = 'easyblock_test_file_' , suffix = '.eb' )
2198
- os .close (handle )
2199
- write_file (toy_ec4 , toytxt + "\n maxparallel = 67" )
2200
-
2201
- handle , toy_ec5 = tempfile .mkstemp (prefix = 'easyblock_test_file_' , suffix = '.eb' )
2202
- os .close (handle )
2203
- write_file (toy_ec5 , toytxt + "\n maxparallel = False" )
2199
+ write_file (toy_ec3 , toytxt + "\n maxparallel = False" )
2204
2200
2205
2201
import easybuild .tools .systemtools as st
2206
2202
auto_parallel = 1337
2207
2203
st .det_parallelism ._default_parallelism = auto_parallel
2208
2204
2205
+ # 'parallel' easyconfig parameter specified is an error
2206
+ self .assertRaises (EasyBuildError , EasyConfig , toy_ec_error )
2207
+ self .assertErrorRegex (EasyBuildError , "Easyconfig parameter 'parallel' is replaced by 'maxparallel'" ,
2208
+ EasyConfig , toy_ec_error )
2209
+
2209
2210
# default: parallelism is derived from # available cores + ulimit
2210
2211
test_eb = EasyBlock (EasyConfig (toy_ec ))
2211
2212
test_eb .check_readiness_step ()
2212
2213
self .assertEqual (test_eb .cfg .parallel , auto_parallel )
2213
2214
2214
- # only 'parallel' easyconfig parameter specified (no 'parallel' build option)
2215
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stderr ():
2216
- test_eb = EasyBlock (EasyConfig (toy_ec1 ))
2217
- test_eb .check_readiness_step ()
2218
- self .assertEqual (test_eb .cfg .parallel , 123 )
2219
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stderr ():
2220
- self .assertEqual (test_eb .cfg ['parallel' ], 123 )
2221
-
2222
- # both 'parallel' and 'maxparallel' easyconfig parameters specified (no 'parallel' build option)
2223
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stderr ():
2224
- test_eb = EasyBlock (EasyConfig (toy_ec2 ))
2215
+ # 'maxparallel = None' is the same as unset
2216
+ test_eb = EasyBlock (EasyConfig (toy_ec1 ))
2225
2217
test_eb .check_readiness_step ()
2226
- self .assertEqual (test_eb .cfg .parallel , 67 )
2227
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stderr ():
2228
- self .assertEqual (test_eb .cfg ['parallel' ], 67 )
2229
-
2230
- # make sure 'parallel = False' is not overriden (no 'parallel' build option)
2231
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stderr ():
2232
- test_eb = EasyBlock (EasyConfig (toy_ec3 ))
2233
- test_eb .check_readiness_step ()
2234
- self .assertEqual (test_eb .cfg .parallel , False )
2235
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stderr ():
2236
- self .assertEqual (test_eb .cfg ['parallel' ], False )
2218
+ self .assertEqual (test_eb .cfg .parallel , auto_parallel )
2237
2219
2238
2220
# only 'maxparallel' easyconfig parameter specified (no 'parallel' build option)
2239
- test_eb = EasyBlock (EasyConfig (toy_ec4 ))
2221
+ test_eb = EasyBlock (EasyConfig (toy_ec2 ))
2240
2222
test_eb .check_readiness_step ()
2241
2223
self .assertEqual (test_eb .cfg .parallel , 67 )
2242
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stderr ():
2243
- self .assertEqual (test_eb .cfg ['parallel' ], 67 )
2244
2224
2245
2225
# make sure 'maxparallel = False' is treated as 1 (no 'parallel' build option)
2246
- test_eb = EasyBlock (EasyConfig (toy_ec5 ))
2226
+ test_eb = EasyBlock (EasyConfig (toy_ec3 ))
2247
2227
test_eb .check_readiness_step ()
2248
2228
self .assertEqual (test_eb .cfg .parallel , 1 )
2249
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stderr ():
2250
- self .assertEqual (test_eb .cfg ['parallel' ], 1 )
2251
2229
2252
2230
# only 'parallel' build option specified
2253
2231
init_config (build_options = {'parallel' : '97' , 'validate' : False })
2254
2232
test_eb = EasyBlock (EasyConfig (toy_ec ))
2255
2233
test_eb .check_readiness_step ()
2256
2234
self .assertEqual (test_eb .cfg .parallel , 97 )
2257
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stderr ():
2258
- self .assertEqual (test_eb .cfg ['parallel' ], 97 )
2259
2235
2260
- # both 'parallel' build option and easyconfig parameter specified (no 'maxparallel')
2261
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stderr ():
2262
- test_eb = EasyBlock (EasyConfig (toy_ec1 ))
2236
+ # 'maxparallel = None' is the same as unset
2237
+ test_eb = EasyBlock (EasyConfig (toy_ec1 ))
2263
2238
test_eb .check_readiness_step ()
2264
2239
self .assertEqual (test_eb .cfg .parallel , 97 )
2265
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stderr ():
2266
- self .assertEqual (test_eb .cfg ['parallel' ], 97 )
2267
-
2268
- # both 'parallel' and 'maxparallel' easyconfig parameters specified + 'parallel' build option
2269
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stderr ():
2270
- test_eb = EasyBlock (EasyConfig (toy_ec2 ))
2271
- test_eb .check_readiness_step ()
2272
- self .assertEqual (test_eb .cfg .parallel , 67 )
2273
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stderr ():
2274
- self .assertEqual (test_eb .cfg ['parallel' ], 67 )
2275
-
2276
- # make sure 'parallel = False' is not overriden (with 'parallel' build option)
2277
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stderr ():
2278
- test_eb = EasyBlock (EasyConfig (toy_ec3 ))
2279
- test_eb .check_readiness_step ()
2280
- self .assertEqual (test_eb .cfg .parallel , 0 )
2281
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stderr ():
2282
- self .assertEqual (test_eb .cfg ['parallel' ], 0 )
2283
2240
2284
- # only 'maxparallel' easyconfig parameter specified ( with 'parallel' build option)
2285
- test_eb = EasyBlock (EasyConfig (toy_ec4 ))
2241
+ # 'maxparallel' easyconfig parameter with 'parallel' build option
2242
+ test_eb = EasyBlock (EasyConfig (toy_ec2 ))
2286
2243
test_eb .check_readiness_step ()
2287
2244
self .assertEqual (test_eb .cfg .parallel , 67 )
2288
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stderr ():
2289
- self .assertEqual (test_eb .cfg ['parallel' ], 67 )
2290
2245
2291
2246
# make sure 'maxparallel = False' is treated as 1 (with 'parallel' build option)
2292
- test_eb = EasyBlock (EasyConfig (toy_ec5 ))
2247
+ test_eb = EasyBlock (EasyConfig (toy_ec3 ))
2293
2248
test_eb .check_readiness_step ()
2294
2249
self .assertEqual (test_eb .cfg .parallel , 1 )
2295
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stderr ():
2296
- self .assertEqual (test_eb .cfg ['parallel' ], 1 )
2297
2250
2298
2251
# Template updated correctly
2299
2252
test_eb .cfg ['buildopts' ] = '-j %(parallel)s'
0 commit comments