@@ -462,31 +462,3 @@ def mock_rename(src, dst):
462462 # Check error message
463463 assert "Error deleting file" in caplog .text
464464 assert source_file in caplog .text
465-
466-
467- def test_error_creating_symlink (temp_dirs , caplog ):
468- """Test error message when symlink creation fails."""
469- source_dir , target_dir = temp_dirs
470- username = os .environ ["USER" ]
471-
472- # Create source file
473- source_file = os .path .join (source_dir , "test.txt" )
474- target_file = os .path .join (target_dir , "test.txt" )
475-
476- with open (source_file , "w" , encoding = "utf-8" ) as f :
477- f .write ("source" )
478- with open (target_file , "w" , encoding = "utf-8" ) as f :
479- f .write ("target" )
480-
481- # Mock os.symlink to raise an error
482- def mock_symlink (src , dst ):
483- raise OSError ("Simulated symlink error" )
484-
485- with patch ("os.symlink" , side_effect = mock_symlink ):
486- # Run the function
487- with caplog .at_level (logging .INFO ):
488- relink .find_and_replace_owned_files (source_dir , target_dir , username )
489-
490- # Check error message
491- assert "Error creating symlink" in caplog .text
492- assert source_file in caplog .text
0 commit comments