This is an automated email from the ASF dual-hosted git repository.

raulcd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 912eec137c GH-48419: [Python] Fix test_parquet_file_too_small to catch 
only ArrowInvalid (#48420)
912eec137c is described below

commit 912eec137c8b27b6e2d082e321e40adddb2c9e48
Author: Hyukjin Kwon <[email protected]>
AuthorDate: Thu Dec 11 02:35:48 2025 +0900

    GH-48419: [Python] Fix test_parquet_file_too_small to catch only 
ArrowInvalid (#48420)
    
    ### Rationale for this change
    
    The test does not throw `OSError` anymore.
    
    ### What changes are included in this PR?
    
    This PR changes `test_parquet_file_too_small` test to only catch 
`ArrowInvalid`.
    
    ### Are these changes tested?
    
    Yes, manually tested via
    
    ```
    pytest pyarrow/tests/parquet/test_basic.py::test_parquet_file_too_small
    ```
    
    ### Are there any user-facing changes?
    
    No, test-only.
    * GitHub Issue: #48419
    
    Authored-by: Hyukjin Kwon <[email protected]>
    Signed-off-by: Raúl Cumplido <[email protected]>
---
 python/pyarrow/tests/parquet/test_basic.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/python/pyarrow/tests/parquet/test_basic.py 
b/python/pyarrow/tests/parquet/test_basic.py
index 3b991fdd57..94868741f3 100644
--- a/python/pyarrow/tests/parquet/test_basic.py
+++ b/python/pyarrow/tests/parquet/test_basic.py
@@ -713,15 +713,12 @@ def test_zlib_compression_bug():
 
 def test_parquet_file_too_small(tempdir):
     path = str(tempdir / "test.parquet")
-    # TODO(dataset) with datasets API it raises OSError instead
-    with pytest.raises((pa.ArrowInvalid, OSError),
-                       match='size is 0 bytes'):
+    with pytest.raises(pa.ArrowInvalid, match='size is 0 bytes'):
         with open(path, 'wb') as f:
             pass
         pq.read_table(path)
 
-    with pytest.raises((pa.ArrowInvalid, OSError),
-                       match='size is 4 bytes'):
+    with pytest.raises(pa.ArrowInvalid, match='size is 4 bytes'):
         with open(path, 'wb') as f:
             f.write(b'ffff')
         pq.read_table(path)

Reply via email to