File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -340,6 +340,21 @@ def test_deleting_s3_file_not_found() -> None:
340340 assert "Cannot delete file, does not exist:" in str (exc_info .value )
341341
342342
343+ def test_deleting_hdfs_file_not_found () -> None :
344+ """Test that a PyArrowFile raises a PermissionError when the pyarrow error includes 'No such file or directory'"""
345+
346+ hdfs_mock = MagicMock ()
347+ hdfs_mock .delete_file .side_effect = OSError ("Path does not exist" )
348+
349+ with patch .object (PyArrowFileIO , "_initialize_fs" ) as submocked :
350+ submocked .return_value = hdfs_mock
351+
352+ with pytest .raises (FileNotFoundError ) as exc_info :
353+ PyArrowFileIO ().delete ("hdfs://foo/bar.txt" )
354+
355+ assert "Cannot delete file, does not exist:" in str (exc_info .value )
356+
357+
343358def test_pyarrow_s3_session_properties () -> None :
344359 session_properties : Properties = {
345360 "s3.endpoint" : "http://localhost:9000" ,
You can’t perform that action at this time.
0 commit comments