File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -394,3 +394,25 @@ async def test_validate_environment():
394
394
editor = TextEditor ()
395
395
# Currently just verifies it can be called without error
396
396
editor ._validate_environment ()
397
+
398
+
399
+ @pytest .mark .asyncio
400
+ async def test_edit_file_contents_io_error (editor , tmp_path ):
401
+ """Test editing file with IO error."""
402
+ test_file = tmp_path / "io_error_test.txt"
403
+ test_file .write_text ("test content" )
404
+
405
+ # Make file read-only
406
+ test_file .chmod (0o444 )
407
+
408
+ result = await editor .edit_file_contents (
409
+ str (test_file ),
410
+ editor .calculate_hash ("test content" ),
411
+ [{"line_start" : 1 , "contents" : "new content" }],
412
+ )
413
+
414
+ assert result ["result" ] == "error"
415
+ assert "permission denied" in result ["reason" ].lower ()
416
+
417
+ # Restore permissions for cleanup
418
+ test_file .chmod (0o644 )
You can’t perform that action at this time.
0 commit comments