1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
|
Description: Allow some numba errors on 32-bit
Specifying the exception type allows only explicit errors,
not silently wrong answers
Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Forwarded: no
--- a/pandas/tests/groupby/conftest.py
+++ b/pandas/tests/groupby/conftest.py
@@ -11,6 +11,11 @@ from pandas.core.groupby.base import (
reduction_kernels,
transformation_kernels,
)
+from pandas.compat import IS64
+try:
+ from numba.core.errors import UnsupportedParforsError
+except ImportError: # numba not installed
+ UnsupportedParforsError = ImportError
@pytest.fixture(params=[True, False])
@@ -153,7 +158,22 @@ def groupby_func(request):
return request.param
-@pytest.fixture(params=[True, False])
+# the xfail is because numba does not support this on 32-bit systems
+# https://github.com/numba/numba/blob/main/numba/parfors/parfors.py
+# strict=False because some tests are of error paths that
+# fail of something else before reaching this point
+@pytest.fixture(params=[
+ pytest.param(
+ True,
+ marks=pytest.mark.xfail(
+ condition=not IS64,
+ reason="parfors not available on 32-bit",
+ raises=UnsupportedParforsError,
+ strict=False,
+ )
+ ),
+ False,
+ ])
def parallel(request):
"""parallel keyword argument for numba.jit"""
return request.param
--- a/pandas/tests/window/conftest.py
+++ b/pandas/tests/window/conftest.py
@@ -13,6 +13,12 @@ from pandas import (
Series,
bdate_range,
)
+from pandas.compat import IS64
+try:
+ from numba.core.errors import UnsupportedParforsError, TypingError
+except ImportError: # numba not installed
+ UnsupportedParforsError = ImportError
+ TypingError = ImportError
@pytest.fixture(params=[True, False])
@@ -50,7 +56,22 @@ def min_periods(request):
return request.param
-@pytest.fixture(params=[True, False])
+# the xfail is because numba does not support this on 32-bit systems
+# https://github.com/numba/numba/blob/main/numba/parfors/parfors.py
+# strict=False because some tests are of error paths that
+# fail of something else before reaching this point
+@pytest.fixture(params=[
+ pytest.param(
+ True,
+ marks=pytest.mark.xfail(
+ condition=not IS64,
+ reason="parfors not available on 32-bit",
+ raises=(UnsupportedParforsError, TypingError),
+ strict=False,
+ )
+ ),
+ False,
+ ])
def parallel(request):
"""parallel keyword argument for numba.jit"""
return request.param
--- a/pandas/tests/window/test_numba.py
+++ b/pandas/tests/window/test_numba.py
@@ -1,6 +1,12 @@
import numpy as np
import pytest
+from pandas.compat import IS64
+try:
+ from numba.core.errors import UnsupportedParforsError, TypingError
+except ImportError: # numba not installed
+ UnsupportedParforsError = ImportError
+ TypingError = ImportError
from pandas.errors import NumbaUtilError
import pandas.util._test_decorators as td
@@ -186,6 +192,12 @@ class TestEngine:
expected = DataFrame({"value": [2.0, 2.0, 2.0]})
tm.assert_frame_equal(result, expected)
+ @pytest.mark.xfail(
+ condition=not IS64,
+ reason="parfors not available on 32-bit",
+ raises=UnsupportedParforsError,
+ strict=False,
+ )
def test_dont_cache_engine_kwargs(self):
# If the user passes a different set of engine_kwargs don't return the same
# jitted function
@@ -326,6 +338,12 @@ class TestTableMethod:
f, engine="numba", raw=True
)
+ @pytest.mark.xfail(
+ condition=not IS64,
+ reason="parfors not available on 32-bit",
+ raises=(UnsupportedParforsError, TypingError),
+ strict=False,
+ )
def test_table_method_rolling_methods(
self,
axis,
@@ -408,6 +426,12 @@ class TestTableMethod:
)
tm.assert_frame_equal(result, expected)
+ @pytest.mark.xfail(
+ condition=not IS64,
+ reason="parfors not available on 32-bit",
+ raises=(UnsupportedParforsError, TypingError),
+ strict=False,
+ )
def test_table_method_expanding_methods(
self, axis, nogil, parallel, nopython, arithmetic_numba_supported_operators
):
--- a/pandas/tests/groupby/aggregate/test_numba.py
+++ b/pandas/tests/groupby/aggregate/test_numba.py
@@ -11,6 +11,12 @@ from pandas import (
option_context,
)
import pandas._testing as tm
+from pandas.compat import IS64
+try:
+ from numba.core.errors import UnsupportedParforsError, TypingError
+except ImportError: # numba not installed
+ UnsupportedParforsError = ImportError
+ TypingError = ImportError
pytestmark = pytest.mark.single_cpu
@@ -252,6 +258,12 @@ def test_multifunc_numba_vs_cython_serie
),
],
)
+@pytest.mark.xfail(
+ condition=not IS64,
+ reason="parfors not available on 32-bit",
+ raises=UnsupportedParforsError,
+ strict=False,
+)
def test_multifunc_numba_kwarg_propagation(data, agg_kwargs):
pytest.importorskip("numba")
labels = ["a", "a", "b", "b", "a"]
|