@@ -336,9 +336,9 @@ def test_copyfile_preserves_perms_before_move(tmp_path):
336336 source = str (tmp_path / "source" )
337337 dest = str (tmp_path / "dest" )
338338
339- with open (source , "w" ) as f :
339+ with salt . utils . files . fopen (source , "w" ) as f :
340340 f .write ("new content" )
341- with open (dest , "w" ) as f :
341+ with salt . utils . files . fopen (dest , "w" ) as f :
342342 f .write ("old content" )
343343 os .chmod (dest , 0o644 )
344344
@@ -350,7 +350,7 @@ def test_copyfile_preserves_perms_before_move(tmp_path):
350350
351351 dest_mode_after = stat_mod .S_IMODE (os .stat (dest ).st_mode )
352352 assert dest_mode_after == dest_mode_before
353- with open (dest ) as f :
353+ with salt . utils . files . fopen (dest ) as f :
354354 assert f .read () == "new content"
355355
356356
@@ -367,9 +367,9 @@ def test_copyfile_perms_applied_before_move(tmp_path):
367367 source = str (tmp_path / "source" )
368368 dest = str (tmp_path / "dest" )
369369
370- with open (source , "w" ) as f :
370+ with salt . utils . files . fopen (source , "w" ) as f :
371371 f .write ("new content" )
372- with open (dest , "w" ) as f :
372+ with salt . utils . files . fopen (dest , "w" ) as f :
373373 f .write ("old content" )
374374 os .chmod (dest , 0o644 )
375375
@@ -405,9 +405,9 @@ def patched_stat(path):
405405 return fake_stat
406406 return result
407407
408- with patch ("salt.utils.files.shutil.move" , side_effect = capturing_move ), \
409- patch ( "salt.utils.files.os.chown" , side_effect = capturing_chown ), \
410- patch ("salt.utils.files.os.stat" , side_effect = patched_stat ):
408+ with patch ("salt.utils.files.shutil.move" , side_effect = capturing_move ), patch (
409+ "salt.utils.files.os.chown" , side_effect = capturing_chown
410+ ), patch ("salt.utils.files.os.stat" , side_effect = patched_stat ):
411411 salt .utils .files .copyfile (source , dest )
412412
413413 assert move_called , "shutil.move was not called"
@@ -426,10 +426,10 @@ def test_copyfile_new_file(tmp_path):
426426 source = str (tmp_path / "source" )
427427 dest = str (tmp_path / "dest" )
428428
429- with open (source , "w" ) as f :
429+ with salt . utils . files . fopen (source , "w" ) as f :
430430 f .write ("content" )
431431
432432 salt .utils .files .copyfile (source , dest )
433433
434- with open (dest ) as f :
434+ with salt . utils . files . fopen (dest ) as f :
435435 assert f .read () == "content"
0 commit comments