Skip to content

CI: Unpin pytest #35272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Jul 29, 2020
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/deps/azure-36-32bit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ dependencies:
- pip
- pip:
- cython>=0.29.16
- pytest>=5.0.1,<6.0.0rc0
- pytest>=5.0.1
2 changes: 1 addition & 1 deletion ci/deps/azure-36-locale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:

# tools
- cython>=0.29.16
- pytest>=5.0.1,<6.0.0rc0
- pytest>=5.0.1
- pytest-xdist>=1.21
- pytest-asyncio
- hypothesis>=3.58.0
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/azure-36-locale_slow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:

# tools
- cython>=0.29.16
- pytest>=5.0.1,<6.0.0rc0
- pytest>=5.0.1
- pytest-xdist>=1.21
- hypothesis>=3.58.0
- pytest-azurepipelines
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/azure-36-minimum_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:

# tools
- cython=0.29.16
- pytest>=5.0.1, <6.0.0rc0
- pytest>=5.0.1
- pytest-xdist>=1.21
- hypothesis>=3.58.0
- pytest-azurepipelines
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/azure-36-slow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:

# tools
- cython>=0.29.16
- pytest>=5.0.1,<6.0.0rc0
- pytest>=5.0.1
- pytest-xdist>=1.21
- hypothesis>=3.58.0

Expand Down
2 changes: 1 addition & 1 deletion ci/deps/azure-37-locale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:

# tools
- cython>=0.29.16
- pytest>=5.0.1,<6.0.0rc0
- pytest>=5.0.1
- pytest-xdist>=1.21
- pytest-asyncio
- hypothesis>=3.58.0
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/azure-37-numpydev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dependencies:
- python=3.7.*

# tools
- pytest>=5.0.1,<6.0.0rc0
- pytest>=5.0.1
- pytest-xdist>=1.21
- hypothesis>=3.58.0
- pytest-azurepipelines
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/azure-macos-36.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dependencies:
- python=3.6.*

# tools
- pytest>=5.0.1,<6.0.0rc0
- pytest>=5.0.1
- pytest-xdist>=1.21
- hypothesis>=3.58.0
- pytest-azurepipelines
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/azure-windows-36.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:

# tools
- cython>=0.29.16
- pytest>=5.0.1,<6.0.0rc0
- pytest>=5.0.1
- pytest-xdist>=1.21
- hypothesis>=3.58.0
- pytest-azurepipelines
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/azure-windows-37.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:

# tools
- cython>=0.29.16
- pytest>=5.0.1,<6.0.0rc0
- pytest>=5.0.1
- pytest-xdist>=1.21
- hypothesis>=3.58.0
- pytest-azurepipelines
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/travis-36-cov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:

# tools
- cython>=0.29.16
- pytest>=5.0.1,<6.0.0rc0
- pytest>=5.0.1
- pytest-xdist>=1.21
- hypothesis>=3.58.0
- pytest-cov # this is only needed in the coverage build
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/travis-36-locale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:

# tools
- cython>=0.29.16
- pytest>=5.0.1,<6.0.0rc0
- pytest>=5.0.1
- pytest-xdist>=1.21
- hypothesis>=3.58.0

Expand Down
2 changes: 1 addition & 1 deletion ci/deps/travis-37-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:

# tools
- cython>=0.29.13
- pytest>=5.0.1,<6.0.0rc0
- pytest>=5.0.1
- pytest-xdist>=1.21
- hypothesis>=3.58.0

Expand Down
2 changes: 1 addition & 1 deletion ci/deps/travis-37.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:

# tools
- cython>=0.29.16
- pytest>=5.0.1,<6.0.0rc0
- pytest>=5.0.1
- pytest-xdist>=1.21
- hypothesis>=3.58.0

Expand Down
2 changes: 1 addition & 1 deletion ci/deps/travis-38.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:

# tools
- cython>=0.29.16
- pytest>=5.0.1,<6.0.0rc0
- pytest>=5.0.1
- pytest-xdist>=1.21
- hypothesis>=3.58.0

Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ dependencies:
- botocore>=1.11
- hypothesis>=3.82
- moto # mock S3
- pytest>=5.0.1,<6.0.0rc0
- pytest>=5.0.1
- pytest-cov
- pytest-xdist>=1.21
- pytest-asyncio
Expand Down
6 changes: 2 additions & 4 deletions pandas/_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from shutil import rmtree
import string
import tempfile
from typing import Any, Callable, List, Optional, Type, Union, cast
from typing import Any, Callable, ContextManager, List, Optional, Type, Union, cast
import warnings
import zipfile

Expand Down Expand Up @@ -2880,9 +2880,7 @@ def convert_rows_list_to_csv_str(rows_list: List[str]):
return expected


def external_error_raised(
expected_exception: Type[Exception],
) -> Callable[[Type[Exception], None], None]:
def external_error_raised(expected_exception: Type[Exception],) -> ContextManager:
"""
Helper function to mark pytest.raises that have an external error message.

Expand Down
6 changes: 4 additions & 2 deletions pandas/tests/arithmetic/test_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
date_range("20170102", periods=3, tz="US/Eastern").insert(4, pd.NaT),
),
],
ids=lambda x: str(x[0].dtype),
# https://github.com/pytest-dev/pytest/issues/7494
ids=lambda x: str(x[0].dtype), # type: ignore
)
def left_right_dtypes(request):
"""
Expand Down Expand Up @@ -236,7 +237,8 @@ def test_compare_list_like_nan(self, op, array, nulls_fixture, request):
pd.array(list("abcd")),
pd.array(["foo", 3.14, None, object()]),
],
ids=lambda x: str(x.dtype),
# https://github.com/pytest-dev/pytest/issues/7494
ids=lambda x: str(x.dtype), # type: ignore
)
def test_compare_list_like_other(self, op, array, other):
result = op(array, other)
Expand Down
17 changes: 13 additions & 4 deletions pandas/tests/arithmetic/test_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ class TestNumericArraylikeArithmeticWithDatetimeLike:
# TODO: also check name retentention
@pytest.mark.parametrize("box_cls", [np.array, pd.Index, pd.Series])
@pytest.mark.parametrize(
"left", lefts, ids=lambda x: type(x).__name__ + str(x.dtype),
"left",
lefts,
# https://github.com/pytest-dev/pytest/issues/7494
ids=lambda x: type(x).__name__ + str(x.dtype), # type: ignore
)
def test_mul_td64arr(self, left, box_cls):
# GH#22390
Expand All @@ -119,7 +122,10 @@ def test_mul_td64arr(self, left, box_cls):
# TODO: also check name retentention
@pytest.mark.parametrize("box_cls", [np.array, pd.Index, pd.Series])
@pytest.mark.parametrize(
"left", lefts, ids=lambda x: type(x).__name__ + str(x.dtype),
"left",
lefts,
# https://github.com/pytest-dev/pytest/issues/7494
ids=lambda x: type(x).__name__ + str(x.dtype), # type: ignore
)
def test_div_td64arr(self, left, box_cls):
# GH#22390
Expand Down Expand Up @@ -554,13 +560,16 @@ class TestMultiplicationDivision:
pytest.param(
pd.Index,
marks=pytest.mark.xfail(
reason="Index.__div__ always raises", raises=TypeError
reason="Index.__div__ always raises",
# https://github.com/pytest-dev/pytest/issues/7488
raises=TypeError, # type: ignore
),
),
pd.Series,
pd.DataFrame,
],
ids=lambda x: x.__name__,
# https://github.com/pytest-dev/pytest/issues/7494
ids=lambda x: x.__name__, # type: ignore
)
def test_divide_decimal(self, box):
# resolves issue GH#9787
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/arrays/interval/test_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
date_range("20170102", periods=3, tz="US/Eastern"),
),
],
ids=lambda x: str(x[0].dtype),
# https://github.com/pytest-dev/pytest/issues/7494
ids=lambda x: str(x[0].dtype), # type: ignore
)
def left_right_dtypes(request):
"""
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/arrays/interval/test_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def constructor(request):
(Timestamp("2018-01-01"), Timedelta("1 day")),
(0, 1),
],
ids=lambda x: type(x[0]).__name__,
# https://github.com/pytest-dev/pytest/issues/7494
ids=lambda x: type(x[0]).__name__, # type: ignore
)
def start_shift(request):
"""
Expand Down
7 changes: 6 additions & 1 deletion pandas/tests/dtypes/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,12 @@ def get_is_dtype_funcs():
return [getattr(com, fname) for fname in fnames]


@pytest.mark.parametrize("func", get_is_dtype_funcs(), ids=lambda x: x.__name__)
@pytest.mark.parametrize(
"func",
get_is_dtype_funcs(),
# https://github.com/pytest-dev/pytest/issues/7494
ids=lambda x: x.__name__, # type: ignore
)
def test_get_dtype_error_catch(func):
# see gh-15941
#
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/extension/test_sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,8 @@ def test_astype_str(self, data):
expected = pd.Series([str(x) for x in data[:5]], dtype=expected_dtype)
self.assert_series_equal(result, expected)

@pytest.mark.xfail(raises=TypeError, reason="no sparse StringDtype")
# https://github.com/pytest-dev/pytest/issues/7488
@pytest.mark.xfail(raises=TypeError, reason="no sparse StringDtype") # type: ignore
def test_astype_string(self, data):
super().test_astype_string(data)

Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/frame/methods/test_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ def test_diff_axis(self):

@pytest.mark.xfail(
reason="GH#32995 needs to operate column-wise or do inference",
raises=AssertionError,
# https://github.com/pytest-dev/pytest/issues/7488
raises=AssertionError, # type: ignore
)
def test_diff_period(self):
# GH#32995 Don't pass an incorrect axis
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/generic/test_finalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,8 @@ def idfn(x):
return str(x)


@pytest.fixture(params=_all_methods, ids=lambda x: idfn(x[-1]))
# https://github.com/pytest-dev/pytest/issues/7494
@pytest.fixture(params=_all_methods, ids=lambda x: idfn(x[-1])) # type: ignore
def ndframe_method(request):
"""
An NDFrame method returning an NDFrame.
Expand Down
12 changes: 8 additions & 4 deletions pandas/tests/groupby/test_categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -1299,7 +1299,8 @@ def test_series_groupby_on_2_categoricals_unobserved(
):
# GH 17605
if reduction_func == "ngroup":
pytest.skip("ngroup is not truly a reduction")
# https://github.com/pytest-dev/pytest/issues/7495
pytest.skip("ngroup is not truly a reduction") # type: ignore

if reduction_func == "corrwith": # GH 32293
mark = pytest.mark.xfail(
Expand Down Expand Up @@ -1332,7 +1333,8 @@ def test_series_groupby_on_2_categoricals_unobserved_zeroes_or_nans(
# Tests whether the unobserved categories in the result contain 0 or NaN

if reduction_func == "ngroup":
pytest.skip("ngroup is not truly a reduction")
# https://github.com/pytest-dev/pytest/issues/7495
pytest.skip("ngroup is not truly a reduction") # type: ignore
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh here, this is only causing errors since the function is being checked since we have type annotations in the function signature.

I think our policy is that we don't type check the tests themselves.

maybe I should remove the type annotations here instead. @WillAyd

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WillAyd because have warn_unused_ignores = True we need to have pytest 6.0.0 as the minimum version in the dev environment if keep these ignores. I think that removing the type annotations on these tests is probably best.

Copy link
Member Author

@simonjayhawkins simonjayhawkins Jul 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed type annotations from pandas/tests/groupby/test_categorical.py. will remove pytest pin from environment.yml after ci run.


if reduction_func == "corrwith": # GH 32293
mark = pytest.mark.xfail(
Expand Down Expand Up @@ -1380,7 +1382,8 @@ def test_dataframe_groupby_on_2_categoricals_when_observed_is_true(reduction_fun
# Ensure that df.groupby, when 'by' is two pd.Categorical variables,
# does not return the categories that are not in df when observed=True
if reduction_func == "ngroup":
pytest.skip("ngroup does not return the Categories on the index")
# https://github.com/pytest-dev/pytest/issues/7495
pytest.skip("ngroup does not return the Categories on the index") # type: ignore # noqa: E501

df = pd.DataFrame(
{
Expand Down Expand Up @@ -1410,7 +1413,8 @@ def test_dataframe_groupby_on_2_categoricals_when_observed_is_false(
# returns the categories that are not in df when observed=False/None

if reduction_func == "ngroup":
pytest.skip("ngroup does not return the Categories on the index")
# https://github.com/pytest-dev/pytest/issues/7495
pytest.skip("ngroup does not return the Categories on the index") # type: ignore # noqa:E501

if reduction_func == "count": # GH 35028
mark = pytest.mark.xfail(
Expand Down
9 changes: 6 additions & 3 deletions pandas/tests/indexes/interval/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ def test_get_loc_length_one_interval(self, left, right, closed, other_closed):
date_range("20180101", periods=4, tz="US/Eastern"),
timedelta_range("0 days", periods=4),
],
ids=lambda x: str(x.dtype),
# https://github.com/pytest-dev/pytest/issues/7494
ids=lambda x: str(x.dtype), # type: ignore
)
def test_get_loc_datetimelike_nonoverlapping(self, breaks):
# GH 20636
Expand Down Expand Up @@ -125,7 +126,8 @@ def test_get_loc_datetimelike_nonoverlapping(self, breaks):
timedelta_range("2 days", periods=4),
),
],
ids=lambda x: str(x[0].dtype),
# https://github.com/pytest-dev/pytest/issues/7494
ids=lambda x: str(x[0].dtype), # type: ignore
)
def test_get_loc_datetimelike_overlapping(self, arrays):
# GH 20636
Expand All @@ -150,7 +152,8 @@ def test_get_loc_datetimelike_overlapping(self, arrays):
np.arange(3.0, -1.0, -1.0),
np.arange(3, -1, -1),
],
ids=lambda x: str(x.dtype),
# https://github.com/pytest-dev/pytest/issues/7494
ids=lambda x: str(x.dtype), # type: ignore
)
def test_get_loc_decreasing(self, values):
# GH 25860
Expand Down
9 changes: 6 additions & 3 deletions pandas/tests/indexes/interval/test_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ def test_get_item(self, closed):
date_range("20180101", periods=4, tz="US/Eastern"),
timedelta_range("0 days", periods=4),
],
ids=lambda x: str(x.dtype),
# https://github.com/pytest-dev/pytest/issues/7494
ids=lambda x: str(x.dtype), # type: ignore
)
def test_maybe_convert_i8(self, breaks):
# GH 20636
Expand Down Expand Up @@ -376,7 +377,8 @@ def test_maybe_convert_i8_nat(self, breaks):
@pytest.mark.parametrize(
"breaks",
[np.arange(5, dtype="int64"), np.arange(5, dtype="float64")],
ids=lambda x: str(x.dtype),
# https://github.com/pytest-dev/pytest/issues/7494
ids=lambda x: str(x.dtype), # type: ignore
)
@pytest.mark.parametrize(
"make_key",
Expand Down Expand Up @@ -408,7 +410,8 @@ def test_maybe_convert_i8_numeric(self, breaks, make_key):
],
2,
),
ids=lambda x: str(x.dtype),
# https://github.com/pytest-dev/pytest/issues/7494
ids=lambda x: str(x.dtype), # type: ignore
)
@pytest.mark.parametrize(
"make_key",
Expand Down
Loading