Skip to content

Commit 6c2ca29

Browse files
author
pilkibun
committed
TST: add td.skip_if_no_NEP18
1 parent 6b88dcb commit 6c2ca29

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

pandas/compat/numpy/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
_np_version_under1p16 = _nlv < LooseVersion('1.16')
1414
_np_version_under1p17 = _nlv < LooseVersion('1.17')
1515
_is_numpy_dev = '.dev' in str(_nlv)
16-
16+
try:
17+
_NEP18_enabled = np.core.overrides.ENABLE_ARRAY_FUNCTION
18+
except Exception:
19+
_NEP18_enabled = False
1720

1821
if _nlv < '1.13.3':
1922
raise ImportError('this version of pandas is incompatible with '

pandas/util/_test_decorators.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_foo():
3131
import pytest
3232

3333
from pandas.compat import is_platform_32bit, is_platform_windows
34-
from pandas.compat.numpy import _np_version
34+
from pandas.compat.numpy import _NEP18_enabled, _np_version
3535

3636
from pandas.core.computation.expressions import (
3737
_NUMEXPR_INSTALLED, _USE_NUMEXPR)
@@ -165,6 +165,8 @@ def skip_if_no(
165165
"installed->{installed}".format(
166166
enabled=_USE_NUMEXPR,
167167
installed=_NUMEXPR_INSTALLED))
168+
skip_if_no_NEP18 = pytest.mark.skipif(not _NEP18_enabled,
169+
reason="numpy NEP-18 disabled")
168170

169171

170172
def skip_if_np_lt(ver_str, reason=None, *args, **kwds):

0 commit comments

Comments
 (0)