From b022df8968b889c8f55832a909c602840cfe1840 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Tue, 13 Feb 2024 02:20:43 -0500
Subject: [PATCH 5/6] TST: Add missing skips for unavailable pyarrow
The `all_parsers` fixture has this check, but some of the other fixtures
were missing it.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
pandas/core/arrays/arrow/accessors.py | 2 +-
pandas/tests/io/formats/style/test_bar.py | 3 +++
pandas/tests/io/parser/conftest.py | 4 ++++
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/pandas/core/arrays/arrow/accessors.py b/pandas/core/arrays/arrow/accessors.py
index 124f8fb6ad..3175781e53 100644
--- a/pandas/core/arrays/arrow/accessors.py
+++ b/pandas/core/arrays/arrow/accessors.py
@@ -46,7 +46,7 @@ class ArrowAccessor(metaclass=ABCMeta):
def _validate(self, data):
dtype = data.dtype
- if not isinstance(dtype, ArrowDtype):
+ if not pa_version_under10p1 and not isinstance(dtype, ArrowDtype):
# Raise AttributeError so that inspect can handle non-struct Series.
raise AttributeError(self._validation_msg.format(dtype=dtype))
diff --git a/pandas/tests/io/formats/style/test_bar.py b/pandas/tests/io/formats/style/test_bar.py
index b0e4712e8b..41206da56e 100644
--- a/pandas/tests/io/formats/style/test_bar.py
+++ b/pandas/tests/io/formats/style/test_bar.py
@@ -3,6 +3,8 @@ import io
import numpy as np
import pytest
+from pandas.compat._optional import VERSIONS
+
from pandas import (
NA,
DataFrame,
@@ -347,6 +349,7 @@ def test_styler_bar_with_NA_values():
def test_style_bar_with_pyarrow_NA_values():
+ pytest.importorskip("pyarrow", VERSIONS["pyarrow"])
data = """name,age,test1,test2,teacher
Adam,15,95.0,80,Ashby
Bob,16,81.0,82,Ashby
diff --git a/pandas/tests/io/parser/conftest.py b/pandas/tests/io/parser/conftest.py
index 6d5f870f07..88ccf5fee8 100644
--- a/pandas/tests/io/parser/conftest.py
+++ b/pandas/tests/io/parser/conftest.py
@@ -165,6 +165,7 @@ def pyarrow_parser_only(request):
"""
Fixture all of the CSV parsers using the Pyarrow engine.
"""
+ pytest.importorskip("pyarrow", VERSIONS["pyarrow"])
return request.param()
@@ -198,6 +199,9 @@ def all_parsers_all_precisions(request):
Fixture for all allowable combinations of parser
and float precision
"""
+ parser = request.param[0]
+ if parser.engine == "pyarrow":
+ pytest.importorskip("pyarrow", VERSIONS["pyarrow"])
return request.param
--
2.43.0