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

pitrou 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 be9794a8b7 GH-50176: [Python] Explicitly pass exc_type=ImportError to 
importorskip pyarrow.* (#50177)
be9794a8b7 is described below

commit be9794a8b7b976214d206f76636953edf4b1fc82
Author: Raúl Cumplido <[email protected]>
AuthorDate: Tue Jun 16 16:23:12 2026 +0200

    GH-50176: [Python] Explicitly pass exc_type=ImportError to importorskip 
pyarrow.* (#50177)
    
    ### Rationale for this change
    
    Some of our CI jobs are failing due to a breaking change on pytest 9.1:
    https://github.com/pytest-dev/pytest/pull/14293
    
    ### What changes are included in this PR?
    
    Add `exc_type=ImportError` to the `pytest.importorskip("pyarrow.*)` calls
    
    ### Are these changes tested?
    
    Via CI
    
    ### Are there any user-facing changes?
    
    No
    
    * GitHub Issue: #50176
    
    Authored-by: Raúl Cumplido <[email protected]>
    Signed-off-by: Antoine Pitrou <[email protected]>
---
 python/pyarrow/tests/test_array.py              | 2 +-
 python/pyarrow/tests/test_cuda.py               | 6 +++---
 python/pyarrow/tests/test_cuda_numba_interop.py | 2 +-
 python/pyarrow/tests/test_dataset.py            | 2 +-
 python/pyarrow/tests/test_dlpack.py             | 2 +-
 python/pyarrow/tests/test_flight_async.py       | 2 +-
 python/pyarrow/tests/test_io.py                 | 2 +-
 python/pyarrow/tests/test_table.py              | 2 +-
 8 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/python/pyarrow/tests/test_array.py 
b/python/pyarrow/tests/test_array.py
index 2af866c775..0205db2393 100644
--- a/python/pyarrow/tests/test_array.py
+++ b/python/pyarrow/tests/test_array.py
@@ -4352,7 +4352,7 @@ def test_swapped_byte_order_fails(numpy_native_dtype):
 
 
 def test_non_cpu_array():
-    cuda = pytest.importorskip("pyarrow.cuda")
+    cuda = pytest.importorskip("pyarrow.cuda", exc_type=ImportError)
     ctx = cuda.Context(0)
 
     data = np.arange(4, dtype=np.int32)
diff --git a/python/pyarrow/tests/test_cuda.py 
b/python/pyarrow/tests/test_cuda.py
index e06f479987..b995c2dd5f 100644
--- a/python/pyarrow/tests/test_cuda.py
+++ b/python/pyarrow/tests/test_cuda.py
@@ -32,7 +32,7 @@ except ImportError:
     pytestmark = pytest.mark.numpy
 
 
-cuda = pytest.importorskip("pyarrow.cuda")
+cuda = pytest.importorskip("pyarrow.cuda", exc_type=ImportError)
 
 platform = sysconfig.get_platform()
 # TODO: enable ppc64 when Arrow C++ supports IPC in ppc64 systems:
@@ -858,7 +858,7 @@ def test_copy_to():
 
 
 def test_device_interface_array():
-    cffi = pytest.importorskip("pyarrow.cffi")
+    cffi = pytest.importorskip("pyarrow.cffi", exc_type=ImportError)
     ffi = cffi.ffi
 
     c_schema = ffi.new("struct ArrowSchema*")
@@ -911,7 +911,7 @@ def test_device_interface_array():
 
 
 def test_device_interface_batch_array():
-    cffi = pytest.importorskip("pyarrow.cffi")
+    cffi = pytest.importorskip("pyarrow.cffi", exc_type=ImportError)
     ffi = cffi.ffi
 
     c_schema = ffi.new("struct ArrowSchema*")
diff --git a/python/pyarrow/tests/test_cuda_numba_interop.py 
b/python/pyarrow/tests/test_cuda_numba_interop.py
index 876f3c7f76..fa91cd0b49 100644
--- a/python/pyarrow/tests/test_cuda_numba_interop.py
+++ b/python/pyarrow/tests/test_cuda_numba_interop.py
@@ -23,7 +23,7 @@ except ImportError:
     pytestmark = pytest.mark.numpy
 
 dtypes = ['uint8', 'int16', 'float32']
-cuda = pytest.importorskip("pyarrow.cuda")
+cuda = pytest.importorskip("pyarrow.cuda", exc_type=ImportError)
 nb_cuda = pytest.importorskip("numba.cuda")
 
 from numba.cuda.cudadrv.devicearray import DeviceNDArray  # noqa: E402
diff --git a/python/pyarrow/tests/test_dataset.py 
b/python/pyarrow/tests/test_dataset.py
index 3afe3281cb..f8a5ad41a3 100644
--- a/python/pyarrow/tests/test_dataset.py
+++ b/python/pyarrow/tests/test_dataset.py
@@ -5617,7 +5617,7 @@ def 
test_write_dataset_with_scanner_use_projected_schema(tempdir):
 @pytest.mark.parametrize("format", ("ipc", "parquet"))
 def test_read_table_nested_columns(tempdir, format):
     if format == "parquet":
-        pytest.importorskip("pyarrow.parquet")
+        pytest.importorskip("pyarrow.parquet", exc_type=ImportError)
 
     table = pa.table({"user_id": ["abc123", "qrs456"],
                       "a.dotted.field": [1, 2],
diff --git a/python/pyarrow/tests/test_dlpack.py 
b/python/pyarrow/tests/test_dlpack.py
index 7452c8eb4a..51eaa90369 100644
--- a/python/pyarrow/tests/test_dlpack.py
+++ b/python/pyarrow/tests/test_dlpack.py
@@ -154,7 +154,7 @@ def test_dlpack_not_supported():
 
 
 def test_dlpack_cuda_not_supported():
-    cuda = pytest.importorskip("pyarrow.cuda")
+    cuda = pytest.importorskip("pyarrow.cuda", exc_type=ImportError)
 
     schema = pa.schema([pa.field('f0', pa.int16())])
     a0 = pa.array([1, 2, 3], type=pa.int16())
diff --git a/python/pyarrow/tests/test_flight_async.py 
b/python/pyarrow/tests/test_flight_async.py
index 197c78cc07..b1f89b4efe 100644
--- a/python/pyarrow/tests/test_flight_async.py
+++ b/python/pyarrow/tests/test_flight_async.py
@@ -21,7 +21,7 @@ import pytest
 
 import pyarrow
 
-flight = pytest.importorskip("pyarrow.flight")
+flight = pytest.importorskip("pyarrow.flight", exc_type=ImportError)
 pytestmark = pytest.mark.flight
 
 
diff --git a/python/pyarrow/tests/test_io.py b/python/pyarrow/tests/test_io.py
index 824c69c989..3d4ba997b3 100644
--- a/python/pyarrow/tests/test_io.py
+++ b/python/pyarrow/tests/test_io.py
@@ -682,7 +682,7 @@ def test_allocate_buffer_resizable():
 
 @pytest.mark.numpy
 def test_non_cpu_buffer(pickle_module):
-    cuda = pytest.importorskip("pyarrow.cuda")
+    cuda = pytest.importorskip("pyarrow.cuda", exc_type=ImportError)
     ctx = cuda.Context(0)
 
     data = np.array([b'testing'])
diff --git a/python/pyarrow/tests/test_table.py 
b/python/pyarrow/tests/test_table.py
index c6dbbc5145..98635abf4c 100644
--- a/python/pyarrow/tests/test_table.py
+++ b/python/pyarrow/tests/test_table.py
@@ -3516,7 +3516,7 @@ def test_invalid_non_join_column():
 
 @pytest.fixture
 def cuda_context():
-    cuda = pytest.importorskip("pyarrow.cuda")
+    cuda = pytest.importorskip("pyarrow.cuda", exc_type=ImportError)
     return cuda.Context(0)
 
 

Reply via email to