From 1696c0f07c464ea7793221e704f12ede91f821c5 Mon Sep 17 00:00:00 2001 From: Patrick Hoefler <61934744+phofl@users.noreply.github.com> Date: Tue, 4 Jan 2022 11:25:18 +0100 Subject: [PATCH] Pin numpy to get ci back to green (#45179) --- environment.yml | 2 +- pandas/compat/numpy/__init__.py | 1 + pandas/tests/frame/test_ufunc.py | 10 +++++++++- requirements-dev.txt | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/environment.yml b/environment.yml index 86a3df9e90375..bf317d24122ae 100644 --- a/environment.yml +++ b/environment.yml @@ -3,7 +3,7 @@ channels: - conda-forge dependencies: # required - - numpy>=1.18.5 + - numpy>=1.18.5, <1.22.0 - python=3.8 - python-dateutil>=2.8.1 - pytz diff --git a/pandas/compat/numpy/__init__.py b/pandas/compat/numpy/__init__.py index 97af4dee3c0de..c6666551ffad6 100644 --- a/pandas/compat/numpy/__init__.py +++ b/pandas/compat/numpy/__init__.py @@ -9,6 +9,7 @@ np_version_under1p19 = _nlv < Version("1.19") np_version_under1p20 = _nlv < Version("1.20") np_version_under1p22 = _nlv < Version("1.22") +np_version_is1p22 = _nlv == Version("1.22") is_numpy_dev = _nlv.dev is not None _min_numpy_ver = "1.18.5" diff --git a/pandas/tests/frame/test_ufunc.py b/pandas/tests/frame/test_ufunc.py index 4d858fb980860..90b4afd657131 100644 --- a/pandas/tests/frame/test_ufunc.py +++ b/pandas/tests/frame/test_ufunc.py @@ -3,6 +3,7 @@ import numpy as np import pytest +from pandas.compat.numpy import np_version_is1p22 import pandas.util._test_decorators as td import pandas as pd @@ -252,7 +253,7 @@ def test_alignment_deprecation(): @td.skip_if_no("numba") -def test_alignment_deprecation_many_inputs(): +def test_alignment_deprecation_many_inputs(request): # https://github.com/pandas-dev/pandas/issues/39184 # test that the deprecation also works with > 2 inputs -> using a numba # written ufunc for this because numpy itself doesn't have such ufuncs @@ -261,6 +262,13 @@ def test_alignment_deprecation_many_inputs(): vectorize, ) + if np_version_is1p22: + mark = pytest.mark.xfail( + reason="ufunc 'my_ufunc' did not contain a loop with signature matching " + "types", + ) + request.node.add_marker(mark) + @vectorize([float64(float64, float64, float64)]) def my_ufunc(x, y, z): return x + y + z diff --git a/requirements-dev.txt b/requirements-dev.txt index 13e12f5500be5..17881500bfa0c 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,7 +1,7 @@ # This file is auto-generated from environment.yml, do not modify. # See that file for comments about the need/usage of each dependency. -numpy>=1.18.5 +numpy>=1.18.5, <1.22.0 python-dateutil>=2.8.1 pytz asv