diff --git a/pandas/conftest.py b/pandas/conftest.py index 0d6af91d32dea..3b167d9ef4fe2 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -1271,9 +1271,7 @@ def string_dtype(request): @pytest.fixture( params=[ "string[python]", - pytest.param( - "string[pyarrow]", marks=td.skip_if_no("pyarrow", min_version="1.0.0") - ), + pytest.param("string[pyarrow]", marks=td.skip_if_no("pyarrow")), ] ) def nullable_string_dtype(request): @@ -1289,7 +1287,7 @@ def nullable_string_dtype(request): @pytest.fixture( params=[ "python", - pytest.param("pyarrow", marks=td.skip_if_no("pyarrow", min_version="1.0.0")), + pytest.param("pyarrow", marks=td.skip_if_no("pyarrow")), ] ) def string_storage(request): @@ -1332,9 +1330,7 @@ def object_dtype(request): params=[ "object", "string[python]", - pytest.param( - "string[pyarrow]", marks=td.skip_if_no("pyarrow", min_version="1.0.0") - ), + pytest.param("string[pyarrow]", marks=td.skip_if_no("pyarrow")), ] ) def any_string_dtype(request): diff --git a/pandas/tests/io/excel/test_readers.py b/pandas/tests/io/excel/test_readers.py index 3e879b72a8dcf..db8b69bc951f9 100644 --- a/pandas/tests/io/excel/test_readers.py +++ b/pandas/tests/io/excel/test_readers.py @@ -600,15 +600,14 @@ def test_use_nullabla_dtypes_and_dtype(self, read_ext): tm.assert_frame_equal(result, df) @td.skip_if_no("pyarrow") - @pytest.mark.parametrize("storage", ["pyarrow", "python"]) - def test_use_nullable_dtypes_string(self, read_ext, storage): + def test_use_nullable_dtypes_string(self, read_ext, string_storage): # GH#36712 if read_ext in (".xlsb", ".xls"): pytest.skip(f"No engine for filetype: '{read_ext}'") import pyarrow as pa - with pd.option_context("mode.string_storage", storage): + with pd.option_context("mode.string_storage", string_storage): df = DataFrame( { @@ -622,7 +621,7 @@ def test_use_nullable_dtypes_string(self, read_ext, storage): file_path, sheet_name="test", use_nullable_dtypes=True ) - if storage == "python": + if string_storage == "python": expected = DataFrame( { "a": StringArray(np.array(["a", "b"], dtype=np.object_)), diff --git a/pandas/tests/io/parser/dtypes/test_dtypes_basic.py b/pandas/tests/io/parser/dtypes/test_dtypes_basic.py index 95411310bcc35..de3a99bbf7a68 100644 --- a/pandas/tests/io/parser/dtypes/test_dtypes_basic.py +++ b/pandas/tests/io/parser/dtypes/test_dtypes_basic.py @@ -446,12 +446,11 @@ def test_use_nullabla_dtypes_and_dtype(all_parsers): @pytest.mark.usefixtures("pyarrow_xfail") -@pytest.mark.parametrize("storage", ["pyarrow", "python"]) -def test_use_nullable_dtypes_string(all_parsers, storage): +def test_use_nullable_dtypes_string(all_parsers, string_storage): # GH#36712 pa = pytest.importorskip("pyarrow") - with pd.option_context("mode.string_storage", storage): + with pd.option_context("mode.string_storage", string_storage): parser = all_parsers @@ -461,7 +460,7 @@ def test_use_nullable_dtypes_string(all_parsers, storage): """ result = parser.read_csv(StringIO(data), use_nullable_dtypes=True) - if storage == "python": + if string_storage == "python": expected = DataFrame( { "a": StringArray(np.array(["a", "b"], dtype=np.object_)), diff --git a/pandas/tests/io/parser/test_upcast.py b/pandas/tests/io/parser/test_upcast.py index 428050ac01b58..a4111630d1256 100644 --- a/pandas/tests/io/parser/test_upcast.py +++ b/pandas/tests/io/parser/test_upcast.py @@ -89,17 +89,16 @@ def test_maybe_upcaste_all_nan(): @td.skip_if_no("pyarrow") -@pytest.mark.parametrize("storage", ["pyarrow", "python"]) @pytest.mark.parametrize("val", [na_values[np.object_], "c"]) -def test_maybe_upcast_object(val, storage): +def test_maybe_upcast_object(val, string_storage): # GH#36712 import pyarrow as pa - with pd.option_context("mode.string_storage", storage): + with pd.option_context("mode.string_storage", string_storage): arr = np.array(["a", "b", val], dtype=np.object_) result = _maybe_upcast(arr, use_nullable_dtypes=True) - if storage == "python": + if string_storage == "python": exp_val = "c" if val == "c" else NA expected = StringArray(np.array(["a", "b", exp_val], dtype=np.object_)) else: diff --git a/pandas/tests/io/test_sql.py b/pandas/tests/io/test_sql.py index 490b425ee52bf..04a8ca672eeb0 100644 --- a/pandas/tests/io/test_sql.py +++ b/pandas/tests/io/test_sql.py @@ -2276,51 +2276,49 @@ def test_get_engine_auto_error_message(self): pass # TODO(GH#36893) fill this in when we add more engines - @pytest.mark.parametrize("storage", ["pyarrow", "python"]) - def test_read_sql_nullable_dtypes(self, storage): + def test_read_sql_nullable_dtypes(self, string_storage): # GH#50048 table = "test" df = self.nullable_data() df.to_sql(table, self.conn, index=False, if_exists="replace") - with pd.option_context("mode.string_storage", storage): + with pd.option_context("mode.string_storage", string_storage): result = pd.read_sql( f"Select * from {table}", self.conn, use_nullable_dtypes=True ) - expected = self.nullable_expected(storage) + expected = self.nullable_expected(string_storage) tm.assert_frame_equal(result, expected) - with pd.option_context("mode.string_storage", storage): + with pd.option_context("mode.string_storage", string_storage): iterator = pd.read_sql( f"Select * from {table}", self.conn, use_nullable_dtypes=True, chunksize=3, ) - expected = self.nullable_expected(storage) + expected = self.nullable_expected(string_storage) for result in iterator: tm.assert_frame_equal(result, expected) - @pytest.mark.parametrize("storage", ["pyarrow", "python"]) - def test_read_sql_nullable_dtypes_table(self, storage): + def test_read_sql_nullable_dtypes_table(self, string_storage): # GH#50048 table = "test" df = self.nullable_data() df.to_sql(table, self.conn, index=False, if_exists="replace") - with pd.option_context("mode.string_storage", storage): + with pd.option_context("mode.string_storage", string_storage): result = pd.read_sql(table, self.conn, use_nullable_dtypes=True) - expected = self.nullable_expected(storage) + expected = self.nullable_expected(string_storage) tm.assert_frame_equal(result, expected) - with pd.option_context("mode.string_storage", storage): + with pd.option_context("mode.string_storage", string_storage): iterator = pd.read_sql( f"Select * from {table}", self.conn, use_nullable_dtypes=True, chunksize=3, ) - expected = self.nullable_expected(storage) + expected = self.nullable_expected(string_storage) for result in iterator: tm.assert_frame_equal(result, expected) @@ -2450,8 +2448,7 @@ class Test(BaseModel): def nullable_expected(self, storage) -> DataFrame: return super().nullable_expected(storage).astype({"e": "Int64", "f": "Int64"}) - @pytest.mark.parametrize("storage", ["pyarrow", "python"]) - def test_read_sql_nullable_dtypes_table(self, storage): + def test_read_sql_nullable_dtypes_table(self, string_storage): # GH#50048 Not supported for sqlite pass diff --git a/pandas/tests/plotting/test_converter.py b/pandas/tests/plotting/test_converter.py index d0b3b3c413e7a..8ab15abeca7fd 100644 --- a/pandas/tests/plotting/test_converter.py +++ b/pandas/tests/plotting/test_converter.py @@ -10,8 +10,6 @@ import pandas._config.config as cf -import pandas.util._test_decorators as td - from pandas import ( Index, Period, @@ -76,7 +74,6 @@ def test_dont_register_by_default(self): call = [sys.executable, "-c", code] assert subprocess.check_call(call) == 0 - @td.skip_if_no("matplotlib", min_version="3.1.3") def test_registering_no_warning(self): plt = pytest.importorskip("matplotlib.pyplot") s = Series(range(12), index=date_range("2017", periods=12)) @@ -111,7 +108,6 @@ def test_matplotlib_formatters(self): assert Timestamp not in units.registry assert Timestamp in units.registry - @td.skip_if_no("matplotlib", min_version="3.1.3") def test_option_no_warning(self): pytest.importorskip("matplotlib.pyplot") ctx = cf.option_context("plotting.matplotlib.register_converters", False)