File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -902,7 +902,17 @@ def mock_validate_environment(self):
902
902
monkeypatch .setattr (TextEditor , "_validate_environment" , mock_validate_environment )
903
903
904
904
# Verify that initialization fails with the expected error
905
- with pytest .raises (EnvironmentError ) as excinfo :
905
+ with pytest .raises (EnvironmentError , match = "Failed to validate environment" ) :
906
906
TextEditor ()
907
907
908
- assert "Failed to validate environment" in str (excinfo .value )
908
+
909
+ @pytest .mark .asyncio
910
+ async def test_read_file_not_found_error (editor , tmp_path ):
911
+ """Test FileNotFoundError handling when reading a non-existent file."""
912
+ non_existent_file = tmp_path / "does_not_exist.txt"
913
+
914
+ with pytest .raises (FileNotFoundError ) as excinfo :
915
+ await editor ._read_file (str (non_existent_file ))
916
+
917
+ assert "File not found:" in str (excinfo .value )
918
+ assert str (non_existent_file ) in str (excinfo .value )
You can’t perform that action at this time.
0 commit comments