@@ -221,9 +221,12 @@ def test_write_config_file(LocalSession, tmpdir):
221
221
assert os .path .exists (resource_config_file )
222
222
assert os .path .exists (input_data_config_file )
223
223
224
- hyperparameters_data = json .load (open (hyperparameters_file ))
225
- resource_config_data = json .load (open (resource_config_file ))
226
- input_data_config_data = json .load (open (input_data_config_file ))
224
+ with open (hyperparameters_file ) as f :
225
+ hyperparameters_data = json .load (f )
226
+ with open (resource_config_file ) as f :
227
+ resource_config_data = json .load (f )
228
+ with open (input_data_config_file ) as f :
229
+ input_data_config_data = json .load (f )
227
230
228
231
# Validate HyperParameters
229
232
for k , v in HYPERPARAMETERS .items ():
@@ -280,7 +283,8 @@ def test_write_config_files_input_content_type(LocalSession, tmpdir):
280
283
sagemaker_container .write_config_files (host , HYPERPARAMETERS , input_data_config )
281
284
282
285
assert os .path .exists (input_data_config_file )
283
- parsed_input_config = json .load (open (input_data_config_file ))
286
+ with open (input_data_config_file ) as f :
287
+ parsed_input_config = json .load (f )
284
288
# Validate Input Data Config
285
289
for channel in input_data_config :
286
290
assert channel ["ChannelName" ] in parsed_input_config
0 commit comments