Skip to content

Commit 9a8ce25

Browse files
revert
1 parent 076b68b commit 9a8ce25

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/io/test_pyarrow.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
343358
def test_pyarrow_s3_session_properties() -> None:
344359
session_properties: Properties = {
345360
"s3.endpoint": "http://localhost:9000",

0 commit comments

Comments
 (0)