From 2a004cbdf62a40a16d528c22320d6ecbf44f2c80 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Tue, 4 Feb 2025 10:12:30 -0800 Subject: [PATCH 01/12] TST: Apply skip/xfail markers for numba/dask updates --- pandas/tests/apply/test_frame_apply.py | 10 ++++++++++ pandas/tests/test_downstream.py | 8 +++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/pandas/tests/apply/test_frame_apply.py b/pandas/tests/apply/test_frame_apply.py index d36d723c4be6a..b9e407adc3051 100644 --- a/pandas/tests/apply/test_frame_apply.py +++ b/pandas/tests/apply/test_frame_apply.py @@ -4,6 +4,8 @@ import numpy as np import pytest +from pandas.compat import is_platform_arm + from pandas.core.dtypes.dtypes import CategoricalDtype import pandas as pd @@ -16,6 +18,7 @@ ) import pandas._testing as tm from pandas.tests.frame.common import zip_frames +from pandas.util.version import Version @pytest.fixture @@ -65,6 +68,13 @@ def test_apply(float_frame, engine, request): @pytest.mark.parametrize("raw", [True, False]) @pytest.mark.parametrize("nopython", [True, False]) def test_apply_args(float_frame, axis, raw, engine, nopython): + numba = pytest.importorskip("numba") + if ( + engine == "numba" + and Version(numba.__version__) == Version("0.61") + and is_platform_arm() + ): + pytest.skip(f"Segfaults on ARM platforms with numba {numba.__version__}") engine_kwargs = {"nopython": nopython} result = float_frame.apply( lambda x, y: x + y, diff --git a/pandas/tests/test_downstream.py b/pandas/tests/test_downstream.py index 18df76ddd8ed8..843124e4f03c2 100644 --- a/pandas/tests/test_downstream.py +++ b/pandas/tests/test_downstream.py @@ -20,6 +20,7 @@ TimedeltaIndex, ) import pandas._testing as tm +from pandas.util.version import Version @pytest.fixture @@ -222,7 +223,7 @@ def test_missing_required_dependency(): assert name in output -def test_frame_setitem_dask_array_into_new_col(): +def test_frame_setitem_dask_array_into_new_col(request): # GH#47128 # dask sets "compute.use_numexpr" to False, so catch the current value @@ -230,8 +231,13 @@ def test_frame_setitem_dask_array_into_new_col(): olduse = pd.get_option("compute.use_numexpr") try: + dask = pytest.importorskip("dask") da = pytest.importorskip("dask.array") + if Version(dask.__version__) >= Version("2025.1.0"): + request.applymarker( + pytest.mark.xfail("loc.__setitem__ incorrectly mutated column c") + ) dda = da.array([1, 2]) df = DataFrame({"a": ["a", "b"]}) df["b"] = dda From f43ba260343d7f9d5366e8a6f66b88cacca6084a Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Tue, 4 Feb 2025 13:29:53 -0800 Subject: [PATCH 02/12] skip test_numba_vs_python_noop --- pandas/tests/apply/test_numba.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pandas/tests/apply/test_numba.py b/pandas/tests/apply/test_numba.py index d6cd9c321ace6..9cc9f12dd8bd2 100644 --- a/pandas/tests/apply/test_numba.py +++ b/pandas/tests/apply/test_numba.py @@ -1,6 +1,7 @@ import numpy as np import pytest +from pandas.compat import is_platform_arm import pandas.util._test_decorators as td import pandas as pd @@ -9,6 +10,7 @@ Index, ) import pandas._testing as tm +from pandas.util.version import Version pytestmark = [td.skip_if_no("numba"), pytest.mark.single_cpu] @@ -19,6 +21,9 @@ def apply_axis(request): def test_numba_vs_python_noop(float_frame, apply_axis): + numba = pytest.importorskip("numba") + if Version(numba.__version__) == Version("0.61") and is_platform_arm(): + pytest.skip(f"Segfaults on ARM platforms with numba {numba.__version__}") func = lambda x: x result = float_frame.apply(func, engine="numba", axis=apply_axis) expected = float_frame.apply(func, engine="python", axis=apply_axis) From 14099196048a65f3080fcd74407f167610348e6d Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Tue, 4 Feb 2025 13:31:00 -0800 Subject: [PATCH 03/12] Add reason --- pandas/tests/test_downstream.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/test_downstream.py b/pandas/tests/test_downstream.py index 843124e4f03c2..138973f8db1e8 100644 --- a/pandas/tests/test_downstream.py +++ b/pandas/tests/test_downstream.py @@ -236,7 +236,7 @@ def test_frame_setitem_dask_array_into_new_col(request): if Version(dask.__version__) >= Version("2025.1.0"): request.applymarker( - pytest.mark.xfail("loc.__setitem__ incorrectly mutated column c") + pytest.mark.xfail(reason="loc.__setitem__ incorrectly mutated column c") ) dda = da.array([1, 2]) df = DataFrame({"a": ["a", "b"]}) From 7abe7831023c99cdb8a04273d5614c9fdb282896 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Tue, 4 Feb 2025 14:51:38 -0800 Subject: [PATCH 04/12] Skip another test --- pandas/tests/apply/test_numba.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandas/tests/apply/test_numba.py b/pandas/tests/apply/test_numba.py index 9cc9f12dd8bd2..9283b514d3971 100644 --- a/pandas/tests/apply/test_numba.py +++ b/pandas/tests/apply/test_numba.py @@ -32,6 +32,9 @@ def test_numba_vs_python_noop(float_frame, apply_axis): def test_numba_vs_python_string_index(): # GH#56189 + numba = pytest.importorskip("numba") + if Version(numba.__version__) == Version("0.61") and is_platform_arm(): + pytest.skip(f"Segfaults on ARM platforms with numba {numba.__version__}") df = DataFrame( 1, index=Index(["a", "b"], dtype=pd.StringDtype(na_value=np.nan)), From acb7daf146533428b490923f961697c460875ce3 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Tue, 4 Feb 2025 17:25:06 -0800 Subject: [PATCH 05/12] Append a skipif --- pandas/tests/apply/test_numba.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pandas/tests/apply/test_numba.py b/pandas/tests/apply/test_numba.py index 9283b514d3971..75bc3f5b74b9d 100644 --- a/pandas/tests/apply/test_numba.py +++ b/pandas/tests/apply/test_numba.py @@ -12,7 +12,15 @@ import pandas._testing as tm from pandas.util.version import Version -pytestmark = [td.skip_if_no("numba"), pytest.mark.single_cpu] +pytestmark = [td.skip_if_no("numba"), pytest.mark.single_cpu, pytest.mark.skipif()] + +numba = pytest.importorskip("numba") +pytestmark.append( + pytest.mark.skipif( + Version(numba.__version__) == Version("0.61") and is_platform_arm(), + reason=f"Segfaults on ARM platforms with numba {numba.__version__}", + ) +) @pytest.fixture(params=[0, 1]) @@ -21,9 +29,6 @@ def apply_axis(request): def test_numba_vs_python_noop(float_frame, apply_axis): - numba = pytest.importorskip("numba") - if Version(numba.__version__) == Version("0.61") and is_platform_arm(): - pytest.skip(f"Segfaults on ARM platforms with numba {numba.__version__}") func = lambda x: x result = float_frame.apply(func, engine="numba", axis=apply_axis) expected = float_frame.apply(func, engine="python", axis=apply_axis) @@ -32,9 +37,6 @@ def test_numba_vs_python_noop(float_frame, apply_axis): def test_numba_vs_python_string_index(): # GH#56189 - numba = pytest.importorskip("numba") - if Version(numba.__version__) == Version("0.61") and is_platform_arm(): - pytest.skip(f"Segfaults on ARM platforms with numba {numba.__version__}") df = DataFrame( 1, index=Index(["a", "b"], dtype=pd.StringDtype(na_value=np.nan)), From 59869f2737b84a0505c4ceab5053b8b5eaff9f5a Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Tue, 4 Feb 2025 19:07:12 -0800 Subject: [PATCH 06/12] Skip test_info_compute_numba --- pandas/tests/frame/methods/test_info.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pandas/tests/frame/methods/test_info.py b/pandas/tests/frame/methods/test_info.py index 462d86cadde88..de6737ec3bc39 100644 --- a/pandas/tests/frame/methods/test_info.py +++ b/pandas/tests/frame/methods/test_info.py @@ -11,6 +11,7 @@ HAS_PYARROW, IS64, PYPY, + is_platform_arm, ) from pandas import ( @@ -23,6 +24,7 @@ option_context, ) import pandas._testing as tm +from pandas.util.version import Version @pytest.fixture @@ -544,7 +546,9 @@ def test_memory_usage_empty_no_warning(using_infer_string): @pytest.mark.single_cpu def test_info_compute_numba(): # GH#51922 - pytest.importorskip("numba") + numba = pytest.importorskip("numba") + if Version(numba.__version__) == Version("0.61") and is_platform_arm(): + pytest.skip(f"Segfaults on ARM platforms with numba {numba.__version__}") df = DataFrame([[1, 2], [3, 4]]) with option_context("compute.use_numba", True): From 5e859ec9f019b92e6ad785af6cbb060612e8dfeb Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Wed, 5 Feb 2025 09:56:17 -0800 Subject: [PATCH 07/12] add skipif for test_numba --- pandas/tests/groupby/aggregate/test_numba.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pandas/tests/groupby/aggregate/test_numba.py b/pandas/tests/groupby/aggregate/test_numba.py index 0cd8a14d97eb0..afddc90fdd055 100644 --- a/pandas/tests/groupby/aggregate/test_numba.py +++ b/pandas/tests/groupby/aggregate/test_numba.py @@ -1,6 +1,7 @@ import numpy as np import pytest +from pandas.compat import is_platform_arm from pandas.errors import NumbaUtilError from pandas import ( @@ -11,8 +12,17 @@ option_context, ) import pandas._testing as tm +from pandas.util.version import Version -pytestmark = pytest.mark.single_cpu +pytestmark = [pytest.mark.single_cpu] + +numba = pytest.importorskip("numba") +pytestmark.append( + pytest.mark.skipif( + Version(numba.__version__) == Version("0.61") and is_platform_arm(), + reason=f"Segfaults on ARM platforms with numba {numba.__version__}", + ) +) def test_correct_function_signature(): From a0cdf04898f25cd34a59e74594e2aba0e31b2540 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Wed, 5 Feb 2025 10:50:59 -0800 Subject: [PATCH 08/12] Add skipif on test_numba --- pandas/tests/groupby/test_numba.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pandas/tests/groupby/test_numba.py b/pandas/tests/groupby/test_numba.py index 3e32031e51138..082319d8479f0 100644 --- a/pandas/tests/groupby/test_numba.py +++ b/pandas/tests/groupby/test_numba.py @@ -1,15 +1,24 @@ import pytest +from pandas.compat import is_platform_arm + from pandas import ( DataFrame, Series, option_context, ) import pandas._testing as tm +from pandas.util.version import Version -pytestmark = pytest.mark.single_cpu +pytestmark = [pytest.mark.single_cpu] -pytest.importorskip("numba") +numba = pytest.importorskip("numba") +pytestmark.append( + pytest.mark.skipif( + Version(numba.__version__) == Version("0.61") and is_platform_arm(), + reason=f"Segfaults on ARM platforms with numba {numba.__version__}", + ) +) @pytest.mark.filterwarnings("ignore") From bac11d46f3942f55b3386f2f949efb7e812caee1 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Wed, 5 Feb 2025 11:58:13 -0800 Subject: [PATCH 09/12] Add skipif for transform/test_numba --- pandas/tests/groupby/transform/test_numba.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pandas/tests/groupby/transform/test_numba.py b/pandas/tests/groupby/transform/test_numba.py index 969df8ef4c52b..e19b7592f75b3 100644 --- a/pandas/tests/groupby/transform/test_numba.py +++ b/pandas/tests/groupby/transform/test_numba.py @@ -1,6 +1,7 @@ import numpy as np import pytest +from pandas.compat import is_platform_arm from pandas.errors import NumbaUtilError from pandas import ( @@ -9,8 +10,17 @@ option_context, ) import pandas._testing as tm +from pandas.util.version import Version -pytestmark = pytest.mark.single_cpu +pytestmark = [pytest.mark.single_cpu] + +numba = pytest.importorskip("numba") +pytestmark.append( + pytest.mark.skipif( + Version(numba.__version__) == Version("0.61") and is_platform_arm(), + reason=f"Segfaults on ARM platforms with numba {numba.__version__}", + ) +) def test_correct_function_signature(): From 698bb2af489bac04b33f998888012c2c6301babc Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Fri, 7 Feb 2025 11:10:54 -0800 Subject: [PATCH 10/12] Remove redundant condition in dask test --- pandas/tests/test_downstream.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pandas/tests/test_downstream.py b/pandas/tests/test_downstream.py index 711a43605b9e7..76fad35304fe6 100644 --- a/pandas/tests/test_downstream.py +++ b/pandas/tests/test_downstream.py @@ -240,10 +240,6 @@ def test_frame_setitem_dask_array_into_new_col(request): pytest.mark.xfail(reason="loc.__setitem__ incorrectly mutated column c") ) - if Version(dask.__version__) >= Version("2025.1.0"): - request.applymarker( - pytest.mark.xfail(reason="loc.__setitem__ incorrectly mutated column c") - ) dda = da.array([1, 2]) df = DataFrame({"a": ["a", "b"]}) df["b"] = dda From 8944a02df308d50b63b3a60e45be575e7469e283 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Fri, 7 Feb 2025 11:13:50 -0800 Subject: [PATCH 11/12] Add skipif to window/test_numba --- pandas/tests/window/test_numba.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pandas/tests/window/test_numba.py b/pandas/tests/window/test_numba.py index 120dbe788a23f..887aeca6590dc 100644 --- a/pandas/tests/window/test_numba.py +++ b/pandas/tests/window/test_numba.py @@ -1,6 +1,7 @@ import numpy as np import pytest +from pandas.compat import is_platform_arm from pandas.errors import NumbaUtilError import pandas.util._test_decorators as td @@ -11,8 +12,17 @@ to_datetime, ) import pandas._testing as tm +from pandas.util.version import Version -pytestmark = pytest.mark.single_cpu +pytestmark = [pytest.mark.single_cpu] + +numba = pytest.importorskip("numba") +pytestmark.append( + pytest.mark.skipif( + Version(numba.__version__) == Version("0.61") and is_platform_arm(), + reason=f"Segfaults on ARM platforms with numba {numba.__version__}", + ) +) @pytest.fixture(params=["single", "table"]) From aaa94deb96c5e367b9a894056fe52200048101c0 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Fri, 7 Feb 2025 12:29:14 -0800 Subject: [PATCH 12/12] skipif for test_online --- pandas/tests/window/test_online.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pandas/tests/window/test_online.py b/pandas/tests/window/test_online.py index 14d3a39107bc4..43d55a7992b3c 100644 --- a/pandas/tests/window/test_online.py +++ b/pandas/tests/window/test_online.py @@ -1,15 +1,24 @@ import numpy as np import pytest +from pandas.compat import is_platform_arm + from pandas import ( DataFrame, Series, ) import pandas._testing as tm +from pandas.util.version import Version -pytestmark = pytest.mark.single_cpu +pytestmark = [pytest.mark.single_cpu] -pytest.importorskip("numba") +numba = pytest.importorskip("numba") +pytestmark.append( + pytest.mark.skipif( + Version(numba.__version__) == Version("0.61") and is_platform_arm(), + reason=f"Segfaults on ARM platforms with numba {numba.__version__}", + ) +) @pytest.mark.filterwarnings("ignore")