From 1b0cbbc1bbb4cf573c860e855a4788f2f5aca445 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Tue, 14 Jul 2020 09:27:47 +0100 Subject: [PATCH 01/17] wip --- pandas/_testing.py | 4 ++-- pandas/tests/arithmetic/test_numeric.py | 3 ++- pandas/tests/arrays/interval/test_ops.py | 2 +- pandas/tests/extension/test_sparse.py | 3 ++- pandas/tests/frame/methods/test_diff.py | 3 ++- pandas/tests/plotting/test_frame.py | 3 ++- pandas/tests/scalar/interval/test_ops.py | 2 +- pandas/tests/scalar/timedelta/test_arithmetic.py | 3 ++- pandas/tests/series/test_operators.py | 6 ++++-- pandas/util/_test_decorators.py | 9 ++++----- 10 files changed, 22 insertions(+), 16 deletions(-) diff --git a/pandas/_testing.py b/pandas/_testing.py index fc6df7a95e348..23097656bc2fd 100644 --- a/pandas/_testing.py +++ b/pandas/_testing.py @@ -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 @@ -2882,7 +2882,7 @@ def convert_rows_list_to_csv_str(rows_list: List[str]): def external_error_raised( expected_exception: Type[Exception], -) -> Callable[[Type[Exception], None], None]: +) -> ContextManager: """ Helper function to mark pytest.raises that have an external error message. diff --git a/pandas/tests/arithmetic/test_numeric.py b/pandas/tests/arithmetic/test_numeric.py index 2155846b271fc..7e188f457eab5 100644 --- a/pandas/tests/arithmetic/test_numeric.py +++ b/pandas/tests/arithmetic/test_numeric.py @@ -554,7 +554,8 @@ class TestMultiplicationDivision: pytest.param( pd.Index, marks=pytest.mark.xfail( - reason="Index.__div__ always raises", raises=TypeError + # https://github.com/pytest-dev/pytest/issues/7488 + reason="Index.__div__ always raises", raises=TypeError # type: ignore # noqa ), ), pd.Series, diff --git a/pandas/tests/arrays/interval/test_ops.py b/pandas/tests/arrays/interval/test_ops.py index 9c78c2a48b9ff..fa571f8d4b49d 100644 --- a/pandas/tests/arrays/interval/test_ops.py +++ b/pandas/tests/arrays/interval/test_ops.py @@ -21,7 +21,7 @@ def constructor(request): (Timestamp("2018-01-01"), Timedelta("1 day")), (0, 1), ], - ids=lambda x: type(x[0]).__name__, + ids=lambda x: type(x[0]).__name__, # type: ignore ) def start_shift(request): """ diff --git a/pandas/tests/extension/test_sparse.py b/pandas/tests/extension/test_sparse.py index 68e521b005c02..530776b527cf4 100644 --- a/pandas/tests/extension/test_sparse.py +++ b/pandas/tests/extension/test_sparse.py @@ -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) diff --git a/pandas/tests/frame/methods/test_diff.py b/pandas/tests/frame/methods/test_diff.py index 45f134a93a23a..0135b3a8dff70 100644 --- a/pandas/tests/frame/methods/test_diff.py +++ b/pandas/tests/frame/methods/test_diff.py @@ -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 diff --git a/pandas/tests/plotting/test_frame.py b/pandas/tests/plotting/test_frame.py index 3d85e79b15c4c..86631fb789399 100644 --- a/pandas/tests/plotting/test_frame.py +++ b/pandas/tests/plotting/test_frame.py @@ -2696,7 +2696,8 @@ def test_errorbar_plot(self): with pytest.raises((ValueError, TypeError)): df.plot(yerr=df_err) - @pytest.mark.xfail(reason="Iterator is consumed", raises=ValueError) + # https://github.com/pytest-dev/pytest/issues/7488 + @pytest.mark.xfail(reason="Iterator is consumed", raises=ValueError) # type: ignore @pytest.mark.slow def test_errorbar_plot_iterator(self): with warnings.catch_warnings(): diff --git a/pandas/tests/scalar/interval/test_ops.py b/pandas/tests/scalar/interval/test_ops.py index 2d9f0954af5a8..8de09f7268bd2 100644 --- a/pandas/tests/scalar/interval/test_ops.py +++ b/pandas/tests/scalar/interval/test_ops.py @@ -10,7 +10,7 @@ (Timestamp("2018-01-01"), Timedelta("1 day")), (0, 1), ], - ids=lambda x: type(x[0]).__name__, + ids=lambda x: type(x[0]).__name__, # type: ignore ) def start_shift(request): """ diff --git a/pandas/tests/scalar/timedelta/test_arithmetic.py b/pandas/tests/scalar/timedelta/test_arithmetic.py index cb33f99d9bd91..0f17aa1f8b67b 100644 --- a/pandas/tests/scalar/timedelta/test_arithmetic.py +++ b/pandas/tests/scalar/timedelta/test_arithmetic.py @@ -427,7 +427,8 @@ def test_td_div_numeric_scalar(self): marks=pytest.mark.xfail( # Works on numpy dev only in python 3.9 _is_numpy_dev and not compat.PY39, - raises=RuntimeWarning, + # https://github.com/pytest-dev/pytest/issues/7488 + raises=RuntimeWarning, # type: ignore reason="https://github.com/pandas-dev/pandas/issues/31992", ), ), diff --git a/pandas/tests/series/test_operators.py b/pandas/tests/series/test_operators.py index e1c9682329271..a0381976ab61e 100644 --- a/pandas/tests/series/test_operators.py +++ b/pandas/tests/series/test_operators.py @@ -333,7 +333,8 @@ def test_reversed_xor_with_index_returns_index(self): ops.rand_, marks=pytest.mark.xfail( reason="GH#22092 Index __and__ returns Index intersection", - raises=AssertionError, + # https://github.com/pytest-dev/pytest/issues/7488 + raises=AssertionError, # type: ignore strict=True, ), ), @@ -341,7 +342,8 @@ def test_reversed_xor_with_index_returns_index(self): ops.ror_, marks=pytest.mark.xfail( reason="GH#22092 Index __or__ returns Index union", - raises=AssertionError, + # https://github.com/pytest-dev/pytest/issues/7488 + raises=AssertionError, # type: ignore strict=True, ), ), diff --git a/pandas/util/_test_decorators.py b/pandas/util/_test_decorators.py index 25394dc6775d8..5a0b965ea6844 100644 --- a/pandas/util/_test_decorators.py +++ b/pandas/util/_test_decorators.py @@ -30,6 +30,7 @@ def test_foo(): import numpy as np import pytest +from _pytest.mark import MarkDecorator from pandas.compat import is_platform_32bit, is_platform_windows from pandas.compat._optional import import_optional_dependency @@ -197,13 +198,11 @@ def skip_if_no(package: str, min_version: Optional[str] = None) -> Callable: def skip_if_np_lt( - ver_str: str, reason: Optional[str] = None, *args, **kwds -) -> Callable: + ver_str: str, *args, reason: Optional[str] = None +) -> MarkDecorator: if reason is None: reason = f"NumPy {ver_str} or greater required" - return pytest.mark.skipif( - _np_version < LooseVersion(ver_str), reason=reason, *args, **kwds - ) + return pytest.mark.skipif(_np_version < LooseVersion(ver_str), *args, reason=reason) def parametrize_fixture_doc(*args): From 4afaa184435fd2257e9c9cc2471787268cb90973 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Tue, 14 Jul 2020 09:31:39 +0100 Subject: [PATCH 02/17] unpin pytest --- ci/deps/azure-36-32bit.yaml | 2 +- ci/deps/azure-36-locale.yaml | 2 +- ci/deps/azure-36-locale_slow.yaml | 2 +- ci/deps/azure-36-minimum_versions.yaml | 2 +- ci/deps/azure-36-slow.yaml | 2 +- ci/deps/azure-37-locale.yaml | 2 +- ci/deps/azure-37-numpydev.yaml | 2 +- ci/deps/azure-macos-36.yaml | 2 +- ci/deps/azure-windows-36.yaml | 2 +- ci/deps/azure-windows-37.yaml | 2 +- ci/deps/travis-36-cov.yaml | 2 +- ci/deps/travis-36-locale.yaml | 2 +- ci/deps/travis-37-arm64.yaml | 2 +- ci/deps/travis-37.yaml | 2 +- ci/deps/travis-38.yaml | 2 +- environment.yml | 2 +- requirements-dev.txt | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ci/deps/azure-36-32bit.yaml b/ci/deps/azure-36-32bit.yaml index 2dc53f8181ac4..15704cf0d5427 100644 --- a/ci/deps/azure-36-32bit.yaml +++ b/ci/deps/azure-36-32bit.yaml @@ -23,4 +23,4 @@ dependencies: - pip - pip: - cython>=0.29.16 - - pytest>=5.0.1,<6.0.0rc0 + - pytest>=5.0.1 diff --git a/ci/deps/azure-36-locale.yaml b/ci/deps/azure-36-locale.yaml index d31015fde4741..a9b9a5a47ccf5 100644 --- a/ci/deps/azure-36-locale.yaml +++ b/ci/deps/azure-36-locale.yaml @@ -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 diff --git a/ci/deps/azure-36-locale_slow.yaml b/ci/deps/azure-36-locale_slow.yaml index 23121b985492e..c086b3651afc3 100644 --- a/ci/deps/azure-36-locale_slow.yaml +++ b/ci/deps/azure-36-locale_slow.yaml @@ -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 diff --git a/ci/deps/azure-36-minimum_versions.yaml b/ci/deps/azure-36-minimum_versions.yaml index 9f66f82720b5b..13002e92f4e24 100644 --- a/ci/deps/azure-36-minimum_versions.yaml +++ b/ci/deps/azure-36-minimum_versions.yaml @@ -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 diff --git a/ci/deps/azure-36-slow.yaml b/ci/deps/azure-36-slow.yaml index 0a6d1d13c8549..87bad59fa4873 100644 --- a/ci/deps/azure-36-slow.yaml +++ b/ci/deps/azure-36-slow.yaml @@ -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 diff --git a/ci/deps/azure-37-locale.yaml b/ci/deps/azure-37-locale.yaml index 714e1100b1e1a..81e336cf1ed7f 100644 --- a/ci/deps/azure-37-locale.yaml +++ b/ci/deps/azure-37-locale.yaml @@ -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 diff --git a/ci/deps/azure-37-numpydev.yaml b/ci/deps/azure-37-numpydev.yaml index 451fb5884a4af..5cb58756a6ac1 100644 --- a/ci/deps/azure-37-numpydev.yaml +++ b/ci/deps/azure-37-numpydev.yaml @@ -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 diff --git a/ci/deps/azure-macos-36.yaml b/ci/deps/azure-macos-36.yaml index 81a27465f9e61..eeea249a19ca1 100644 --- a/ci/deps/azure-macos-36.yaml +++ b/ci/deps/azure-macos-36.yaml @@ -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 diff --git a/ci/deps/azure-windows-36.yaml b/ci/deps/azure-windows-36.yaml index 4d7e1d821037b..548660cabaa67 100644 --- a/ci/deps/azure-windows-36.yaml +++ b/ci/deps/azure-windows-36.yaml @@ -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 diff --git a/ci/deps/azure-windows-37.yaml b/ci/deps/azure-windows-37.yaml index 34fca631df6c1..5bbd0e2795d7e 100644 --- a/ci/deps/azure-windows-37.yaml +++ b/ci/deps/azure-windows-37.yaml @@ -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 diff --git a/ci/deps/travis-36-cov.yaml b/ci/deps/travis-36-cov.yaml index 5f5ea8034cddf..177e0d3f4c0af 100644 --- a/ci/deps/travis-36-cov.yaml +++ b/ci/deps/travis-36-cov.yaml @@ -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 diff --git a/ci/deps/travis-36-locale.yaml b/ci/deps/travis-36-locale.yaml index 6bc4aba733ee5..03a1e751b6a86 100644 --- a/ci/deps/travis-36-locale.yaml +++ b/ci/deps/travis-36-locale.yaml @@ -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 diff --git a/ci/deps/travis-37-arm64.yaml b/ci/deps/travis-37-arm64.yaml index f434a03609b26..5cb53489be225 100644 --- a/ci/deps/travis-37-arm64.yaml +++ b/ci/deps/travis-37-arm64.yaml @@ -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 diff --git a/ci/deps/travis-37.yaml b/ci/deps/travis-37.yaml index aaf706d61fe5c..e896233aac63c 100644 --- a/ci/deps/travis-37.yaml +++ b/ci/deps/travis-37.yaml @@ -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 diff --git a/ci/deps/travis-38.yaml b/ci/deps/travis-38.yaml index ac39a223cd086..b879c0f81dab2 100644 --- a/ci/deps/travis-38.yaml +++ b/ci/deps/travis-38.yaml @@ -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 diff --git a/environment.yml b/environment.yml index 32ff8c91cb69c..80dbffebf6b9d 100644 --- a/environment.yml +++ b/environment.yml @@ -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 diff --git a/requirements-dev.txt b/requirements-dev.txt index 3cda38d4b72f5..886f400caf44f 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -32,7 +32,7 @@ boto3 botocore>=1.11 hypothesis>=3.82 moto -pytest>=5.0.1,<6.0.0rc0 +pytest>=5.0.1 pytest-cov pytest-xdist>=1.21 pytest-asyncio From bec76748cc262d3642598ffa55c8647eb3ec5be2 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Tue, 14 Jul 2020 10:53:45 +0100 Subject: [PATCH 03/17] add issue numbers --- pandas/tests/arrays/interval/test_interval.py | 3 ++- pandas/tests/arrays/interval/test_ops.py | 1 + pandas/tests/scalar/interval/test_ops.py | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pandas/tests/arrays/interval/test_interval.py b/pandas/tests/arrays/interval/test_interval.py index d517eaaec68d2..103a0f4a542aa 100644 --- a/pandas/tests/arrays/interval/test_interval.py +++ b/pandas/tests/arrays/interval/test_interval.py @@ -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): """ diff --git a/pandas/tests/arrays/interval/test_ops.py b/pandas/tests/arrays/interval/test_ops.py index fa571f8d4b49d..c8e257a4f76af 100644 --- a/pandas/tests/arrays/interval/test_ops.py +++ b/pandas/tests/arrays/interval/test_ops.py @@ -21,6 +21,7 @@ def constructor(request): (Timestamp("2018-01-01"), Timedelta("1 day")), (0, 1), ], + # https://github.com/pytest-dev/pytest/issues/7494 ids=lambda x: type(x[0]).__name__, # type: ignore ) def start_shift(request): diff --git a/pandas/tests/scalar/interval/test_ops.py b/pandas/tests/scalar/interval/test_ops.py index 8de09f7268bd2..ae60039d81f9f 100644 --- a/pandas/tests/scalar/interval/test_ops.py +++ b/pandas/tests/scalar/interval/test_ops.py @@ -10,6 +10,7 @@ (Timestamp("2018-01-01"), Timedelta("1 day")), (0, 1), ], + # https://github.com/pytest-dev/pytest/issues/7494 ids=lambda x: type(x[0]).__name__, # type: ignore ) def start_shift(request): From d1a8242f0b215682a67ce5ec1ff8209e719fef90 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Tue, 14 Jul 2020 11:04:23 +0100 Subject: [PATCH 04/17] lint fixup --- pandas/_testing.py | 4 +--- pandas/tests/arithmetic/test_numeric.py | 3 ++- pandas/util/_test_decorators.py | 6 ++---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/pandas/_testing.py b/pandas/_testing.py index 23097656bc2fd..1cf9304ed2715 100644 --- a/pandas/_testing.py +++ b/pandas/_testing.py @@ -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], -) -> ContextManager: +def external_error_raised(expected_exception: Type[Exception],) -> ContextManager: """ Helper function to mark pytest.raises that have an external error message. diff --git a/pandas/tests/arithmetic/test_numeric.py b/pandas/tests/arithmetic/test_numeric.py index 7e188f457eab5..dede91afc0c04 100644 --- a/pandas/tests/arithmetic/test_numeric.py +++ b/pandas/tests/arithmetic/test_numeric.py @@ -554,8 +554,9 @@ class TestMultiplicationDivision: pytest.param( pd.Index, marks=pytest.mark.xfail( + reason="Index.__div__ always raises", # https://github.com/pytest-dev/pytest/issues/7488 - reason="Index.__div__ always raises", raises=TypeError # type: ignore # noqa + raises=TypeError, # type: ignore ), ), pd.Series, diff --git a/pandas/util/_test_decorators.py b/pandas/util/_test_decorators.py index 5a0b965ea6844..f70a93c42e0fc 100644 --- a/pandas/util/_test_decorators.py +++ b/pandas/util/_test_decorators.py @@ -28,9 +28,9 @@ def test_foo(): import locale from typing import Callable, Optional +from _pytest.mark import MarkDecorator import numpy as np import pytest -from _pytest.mark import MarkDecorator from pandas.compat import is_platform_32bit, is_platform_windows from pandas.compat._optional import import_optional_dependency @@ -197,9 +197,7 @@ def skip_if_no(package: str, min_version: Optional[str] = None) -> Callable: ) -def skip_if_np_lt( - ver_str: str, *args, reason: Optional[str] = None -) -> MarkDecorator: +def skip_if_np_lt(ver_str: str, *args, reason: Optional[str] = None) -> MarkDecorator: if reason is None: reason = f"NumPy {ver_str} or greater required" return pytest.mark.skipif(_np_version < LooseVersion(ver_str), *args, reason=reason) From c9f76438c8b5f8ca047f5616558c600fc977de3e Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Tue, 14 Jul 2020 11:25:17 +0100 Subject: [PATCH 05/17] wip --- pandas/tests/arithmetic/test_interval.py | 3 ++- pandas/tests/arithmetic/test_numeric.py | 13 ++++++++++--- pandas/tests/dtypes/test_common.py | 7 ++++++- pandas/tests/generic/test_finalize.py | 3 ++- pandas/tests/indexes/interval/test_interval.py | 9 ++++++--- pandas/tests/indexes/multi/test_analytics.py | 6 ++++-- pandas/tests/indexes/test_engines.py | 3 ++- pandas/tests/indexes/test_numpy_compat.py | 8 ++++++-- pandas/tests/internals/test_internals.py | 3 ++- pandas/tests/reshape/merge/test_merge.py | 9 ++++++--- pandas/tests/reshape/test_qcut.py | 3 ++- 11 files changed, 48 insertions(+), 19 deletions(-) diff --git a/pandas/tests/arithmetic/test_interval.py b/pandas/tests/arithmetic/test_interval.py index 50b5fe8e6f6b9..f71ad94ecf73c 100644 --- a/pandas/tests/arithmetic/test_interval.py +++ b/pandas/tests/arithmetic/test_interval.py @@ -236,7 +236,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) diff --git a/pandas/tests/arithmetic/test_numeric.py b/pandas/tests/arithmetic/test_numeric.py index dede91afc0c04..5b75d301a443c 100644 --- a/pandas/tests/arithmetic/test_numeric.py +++ b/pandas/tests/arithmetic/test_numeric.py @@ -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 @@ -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 @@ -562,7 +568,8 @@ class TestMultiplicationDivision: 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 diff --git a/pandas/tests/dtypes/test_common.py b/pandas/tests/dtypes/test_common.py index ce12718e48d0d..fe04f821af487 100644 --- a/pandas/tests/dtypes/test_common.py +++ b/pandas/tests/dtypes/test_common.py @@ -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 # diff --git a/pandas/tests/generic/test_finalize.py b/pandas/tests/generic/test_finalize.py index 4d0f1a326225d..4b87b9adf9296 100644 --- a/pandas/tests/generic/test_finalize.py +++ b/pandas/tests/generic/test_finalize.py @@ -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. diff --git a/pandas/tests/indexes/interval/test_interval.py b/pandas/tests/indexes/interval/test_interval.py index 2755b186f3eae..19543857c8c2a 100644 --- a/pandas/tests/indexes/interval/test_interval.py +++ b/pandas/tests/indexes/interval/test_interval.py @@ -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 @@ -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", @@ -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", diff --git a/pandas/tests/indexes/multi/test_analytics.py b/pandas/tests/indexes/multi/test_analytics.py index 9e4e73e793bac..c6b0c67476603 100644 --- a/pandas/tests/indexes/multi/test_analytics.py +++ b/pandas/tests/indexes/multi/test_analytics.py @@ -234,7 +234,8 @@ def test_map_dictlike(idx, mapper): np.deg2rad, np.rad2deg, ], - ids=lambda func: func.__name__, + # https://github.com/pytest-dev/pytest/issues/7494 + ids=lambda func: func.__name__, # type: ignore ) def test_numpy_ufuncs(idx, func): # test ufuncs of numpy. see: @@ -256,7 +257,8 @@ def test_numpy_ufuncs(idx, func): @pytest.mark.parametrize( "func", [np.isfinite, np.isinf, np.isnan, np.signbit], - ids=lambda func: func.__name__, + # https://github.com/pytest-dev/pytest/issues/7494 + ids=lambda func: func.__name__, # type: ignore ) def test_numpy_type_funcs(idx, func): msg = ( diff --git a/pandas/tests/indexes/test_engines.py b/pandas/tests/indexes/test_engines.py index 9ea70a457e516..092fc829f0be6 100644 --- a/pandas/tests/indexes/test_engines.py +++ b/pandas/tests/indexes/test_engines.py @@ -22,7 +22,8 @@ (libindex.Float64Engine, np.float64), (libindex.Float32Engine, np.float32), ], - ids=lambda x: x[0].__name__, + # https://github.com/pytest-dev/pytest/issues/7494 + ids=lambda x: x[0].__name__, # type: ignore ) def numeric_indexing_engine_type_and_dtype(request): return request.param diff --git a/pandas/tests/indexes/test_numpy_compat.py b/pandas/tests/indexes/test_numpy_compat.py index 043539c173427..92f872880bc28 100644 --- a/pandas/tests/indexes/test_numpy_compat.py +++ b/pandas/tests/indexes/test_numpy_compat.py @@ -42,7 +42,8 @@ np.deg2rad, np.rad2deg, ], - ids=lambda x: x.__name__, + # https://github.com/pytest-dev/pytest/issues/7494 + ids=lambda x: x.__name__, # type: ignore ) def test_numpy_ufuncs_basic(index, func): # test ufuncs of numpy, see: @@ -72,7 +73,10 @@ def test_numpy_ufuncs_basic(index, func): @pytest.mark.parametrize( - "func", [np.isfinite, np.isinf, np.isnan, np.signbit], ids=lambda x: x.__name__ + "func", + [np.isfinite, np.isinf, np.isnan, np.signbit], + # https://github.com/pytest-dev/pytest/issues/7494 + ids=lambda x: x.__name__, # type: ignore ) def test_numpy_ufuncs_other(index, func): # test ufuncs of numpy, see: diff --git a/pandas/tests/internals/test_internals.py b/pandas/tests/internals/test_internals.py index 06ccdd2484a2a..12d63c12cdfae 100644 --- a/pandas/tests/internals/test_internals.py +++ b/pandas/tests/internals/test_internals.py @@ -1132,7 +1132,8 @@ def test_datetime_block_can_hold_element(self): operator.mod, operator.pow, ], - ids=lambda x: x.__name__, + # https://github.com/pytest-dev/pytest/issues/7494 + ids=lambda x: x.__name__, # type: ignore ) def test_binop_other(self, op, value, dtype): skip = { diff --git a/pandas/tests/reshape/merge/test_merge.py b/pandas/tests/reshape/merge/test_merge.py index 4fd3c688b8771..cac8c0c46c24c 100644 --- a/pandas/tests/reshape/merge/test_merge.py +++ b/pandas/tests/reshape/merge/test_merge.py @@ -66,7 +66,8 @@ def get_series_na(): ] -@pytest.fixture(params=get_series(), ids=lambda x: x.dtype.name) +# https://github.com/pytest-dev/pytest/issues/7494 +@pytest.fixture(params=get_series(), ids=lambda x: x.dtype.name) # type: ignore def series_of_dtype(request): """ A parametrized fixture returning a variety of Series of different @@ -75,7 +76,8 @@ def series_of_dtype(request): return request.param -@pytest.fixture(params=get_series(), ids=lambda x: x.dtype.name) +# https://github.com/pytest-dev/pytest/issues/7494 +@pytest.fixture(params=get_series(), ids=lambda x: x.dtype.name) # type: ignore def series_of_dtype2(request): """ A duplicate of the series_of_dtype fixture, so that it can be used @@ -84,7 +86,8 @@ def series_of_dtype2(request): return request.param -@pytest.fixture(params=get_series_na(), ids=lambda x: x.dtype.name) +# https://github.com/pytest-dev/pytest/issues/7494 +@pytest.fixture(params=get_series_na(), ids=lambda x: x.dtype.name) # type: ignore def series_of_dtype_all_na(request): """ A parametrized fixture returning a variety of Series with all NA diff --git a/pandas/tests/reshape/test_qcut.py b/pandas/tests/reshape/test_qcut.py index c436ab5d90578..c1bf1e1ba6274 100644 --- a/pandas/tests/reshape/test_qcut.py +++ b/pandas/tests/reshape/test_qcut.py @@ -210,7 +210,8 @@ def test_single_quantile(data, start, end, length, labels): Series(DatetimeIndex(["20180101", NaT, "20180103"])), Series(TimedeltaIndex(["0 days", NaT, "2 days"])), ], - ids=lambda x: str(x.dtype), + # https://github.com/pytest-dev/pytest/issues/7494 + ids=lambda x: str(x.dtype), # type: ignore ) def test_qcut_nat(ser): # see gh-19768 From 661836f2e68b761a2a66879947d4cfae6f3a1435 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Tue, 14 Jul 2020 11:43:48 +0100 Subject: [PATCH 06/17] wip --- pandas/tests/arithmetic/test_interval.py | 3 ++- pandas/tests/indexes/interval/test_indexing.py | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pandas/tests/arithmetic/test_interval.py b/pandas/tests/arithmetic/test_interval.py index f71ad94ecf73c..3e1129b998ddf 100644 --- a/pandas/tests/arithmetic/test_interval.py +++ b/pandas/tests/arithmetic/test_interval.py @@ -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): """ diff --git a/pandas/tests/indexes/interval/test_indexing.py b/pandas/tests/indexes/interval/test_indexing.py index 3abc6e348748a..3d80251be174b 100644 --- a/pandas/tests/indexes/interval/test_indexing.py +++ b/pandas/tests/indexes/interval/test_indexing.py @@ -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 @@ -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 @@ -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 From 34b99253a7d16335eeefa0972b7d00854f00bea5 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Tue, 14 Jul 2020 12:03:03 +0100 Subject: [PATCH 07/17] do comments fail line too long linting on ci --- pandas/tests/groupby/test_categorical.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pandas/tests/groupby/test_categorical.py b/pandas/tests/groupby/test_categorical.py index 7e4513da37dc9..9f5ec91bcd116 100644 --- a/pandas/tests/groupby/test_categorical.py +++ b/pandas/tests/groupby/test_categorical.py @@ -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( @@ -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 if reduction_func == "corrwith": # GH 32293 mark = pytest.mark.xfail( @@ -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 df = pd.DataFrame( { @@ -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 if reduction_func == "count": # GH 35028 mark = pytest.mark.xfail( From 56c33a7cb293226a01e1b678daa40861574dc8f8 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Tue, 14 Jul 2020 12:06:27 +0100 Subject: [PATCH 08/17] add # noqa:E501 --- pandas/tests/groupby/test_categorical.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/tests/groupby/test_categorical.py b/pandas/tests/groupby/test_categorical.py index 9f5ec91bcd116..d4dd22a55e472 100644 --- a/pandas/tests/groupby/test_categorical.py +++ b/pandas/tests/groupby/test_categorical.py @@ -1383,7 +1383,7 @@ def test_dataframe_groupby_on_2_categoricals_when_observed_is_true(reduction_fun # does not return the categories that are not in df when observed=True if reduction_func == "ngroup": # https://github.com/pytest-dev/pytest/issues/7495 - pytest.skip("ngroup does not return the Categories on the index") # type: ignore + pytest.skip("ngroup does not return the Categories on the index") # type: ignore # noqa: E501 df = pd.DataFrame( { @@ -1414,7 +1414,7 @@ def test_dataframe_groupby_on_2_categoricals_when_observed_is_false( if reduction_func == "ngroup": # https://github.com/pytest-dev/pytest/issues/7495 - pytest.skip("ngroup does not return the Categories on the index") # type: ignore + 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( From e30220729ed3957840c6918c3cbd5e548cf9255b Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Tue, 14 Jul 2020 14:25:10 +0100 Subject: [PATCH 09/17] mypy green locally --- pandas/util/_test_decorators.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/util/_test_decorators.py b/pandas/util/_test_decorators.py index f70a93c42e0fc..9df61561723f2 100644 --- a/pandas/util/_test_decorators.py +++ b/pandas/util/_test_decorators.py @@ -121,7 +121,7 @@ def _skip_if_no_scipy() -> bool: ) -def skip_if_installed(package: str) -> Callable: +def skip_if_installed(package: str) -> MarkDecorator: """ Skip a test if a package is installed. @@ -135,7 +135,7 @@ def skip_if_installed(package: str) -> Callable: ) -def skip_if_no(package: str, min_version: Optional[str] = None) -> Callable: +def skip_if_no(package: str, min_version: Optional[str] = None) -> MarkDecorator: """ Generic function to help skip tests when required packages are not present on the testing system. From 0d20058cbd60857bc1aea9c5a9b57ca79bc8d1b1 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Wed, 15 Jul 2020 19:15:17 +0100 Subject: [PATCH 10/17] remove _pytest --- pandas/util/_test_decorators.py | 13 +++++++++---- setup.cfg | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pandas/util/_test_decorators.py b/pandas/util/_test_decorators.py index 9df61561723f2..8b41007a5703d 100644 --- a/pandas/util/_test_decorators.py +++ b/pandas/util/_test_decorators.py @@ -28,7 +28,6 @@ def test_foo(): import locale from typing import Callable, Optional -from _pytest.mark import MarkDecorator import numpy as np import pytest @@ -121,7 +120,9 @@ def _skip_if_no_scipy() -> bool: ) -def skip_if_installed(package: str) -> MarkDecorator: +# TODO: return type, _pytest.mark.structures.MarkDecorator is not public +# https://github.com/pytest-dev/pytest/issues/7469 +def skip_if_installed(package: str): """ Skip a test if a package is installed. @@ -135,7 +136,9 @@ def skip_if_installed(package: str) -> MarkDecorator: ) -def skip_if_no(package: str, min_version: Optional[str] = None) -> MarkDecorator: +# TODO: return type, _pytest.mark.structures.MarkDecorator is not public +# https://github.com/pytest-dev/pytest/issues/7469 +def skip_if_no(package: str, min_version: Optional[str] = None): """ Generic function to help skip tests when required packages are not present on the testing system. @@ -197,7 +200,9 @@ def skip_if_no(package: str, min_version: Optional[str] = None) -> MarkDecorator ) -def skip_if_np_lt(ver_str: str, *args, reason: Optional[str] = None) -> MarkDecorator: +# TODO: return type, _pytest.mark.structures.MarkDecorator is not public +# https://github.com/pytest-dev/pytest/issues/7469 +def skip_if_np_lt(ver_str: str, *args, reason: Optional[str] = None): if reason is None: reason = f"NumPy {ver_str} or greater required" return pytest.mark.skipif(_np_version < LooseVersion(ver_str), *args, reason=reason) diff --git a/setup.cfg b/setup.cfg index 00af7f6f1b79a..ee5725e36d193 100644 --- a/setup.cfg +++ b/setup.cfg @@ -105,7 +105,7 @@ known_dtypes = pandas.core.dtypes known_post_core = pandas.tseries,pandas.io,pandas.plotting sections = FUTURE,STDLIB,THIRDPARTY,PRE_LIBS,PRE_CORE,DTYPES,FIRSTPARTY,POST_CORE,LOCALFOLDER known_first_party = pandas -known_third_party = _pytest,announce,dateutil,docutils,flake8,git,hypothesis,jinja2,lxml,matplotlib,numpy,numpydoc,pkg_resources,pyarrow,pytest,pytz,requests,scipy,setuptools,sphinx,sqlalchemy,validate_docstrings,validate_unwanted_patterns,yaml,odf +known_third_party = announce,dateutil,docutils,flake8,git,hypothesis,jinja2,lxml,matplotlib,numpy,numpydoc,pkg_resources,pyarrow,pytest,pytz,requests,scipy,setuptools,sphinx,sqlalchemy,validate_docstrings,validate_unwanted_patterns,yaml,odf multi_line_output = 3 include_trailing_comma = True force_grid_wrap = 0 From 23305de32562e533df81a81534f34328acead835 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Wed, 15 Jul 2020 19:51:29 +0100 Subject: [PATCH 11/17] temporary add pytest-master to environment --- environment.yml | 8 ++++---- requirements-dev.txt | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/environment.yml b/environment.yml index 80dbffebf6b9d..3c9addd3c4335 100644 --- a/environment.yml +++ b/environment.yml @@ -51,10 +51,6 @@ dependencies: - botocore>=1.11 - hypothesis>=3.82 - moto # mock S3 - - pytest>=5.0.1 - - pytest-cov - - pytest-xdist>=1.21 - - pytest-asyncio # downstream tests - seaborn @@ -108,3 +104,7 @@ dependencies: - pip: - git+https://github.com/pandas-dev/pydata-sphinx-theme.git@master - git+https://github.com/numpy/numpydoc + - git+https://github.com/pytest-dev/pytest@master + - pytest-cov + - pytest-xdist>=1.21 + - pytest-asyncio diff --git a/requirements-dev.txt b/requirements-dev.txt index 886f400caf44f..ce3a00b0d8db6 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -32,10 +32,6 @@ boto3 botocore>=1.11 hypothesis>=3.82 moto -pytest>=5.0.1 -pytest-cov -pytest-xdist>=1.21 -pytest-asyncio seaborn statsmodels ipywidgets @@ -73,4 +69,8 @@ cftime pyreadstat tabulate>=0.8.3 git+https://github.com/pandas-dev/pydata-sphinx-theme.git@master -git+https://github.com/numpy/numpydoc \ No newline at end of file +git+https://github.com/numpy/numpydoc +git+https://github.com/pytest-dev/pytest@master +pytest-cov +pytest-xdist>=1.21 +pytest-asyncio \ No newline at end of file From fa814c14e2138a53bebb517ae4c7590573f9f1d2 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Wed, 15 Jul 2020 20:55:10 +0100 Subject: [PATCH 12/17] remove ignores for fixed issues --- pandas/tests/arithmetic/test_interval.py | 6 ++---- pandas/tests/arithmetic/test_numeric.py | 17 ++++------------- pandas/tests/arrays/interval/test_interval.py | 3 +-- pandas/tests/arrays/interval/test_ops.py | 3 +-- pandas/tests/dtypes/test_common.py | 7 +------ pandas/tests/extension/test_sparse.py | 3 +-- pandas/tests/frame/methods/test_diff.py | 3 +-- pandas/tests/generic/test_finalize.py | 3 +-- pandas/tests/indexes/interval/test_indexing.py | 9 +++------ pandas/tests/indexes/interval/test_interval.py | 9 +++------ pandas/tests/indexes/multi/test_analytics.py | 6 ++---- pandas/tests/indexes/test_engines.py | 3 +-- pandas/tests/indexes/test_numpy_compat.py | 8 ++------ pandas/tests/internals/test_internals.py | 3 +-- pandas/tests/plotting/test_frame.py | 3 +-- pandas/tests/reshape/merge/test_merge.py | 9 +++------ pandas/tests/reshape/test_qcut.py | 3 +-- pandas/tests/scalar/interval/test_ops.py | 3 +-- .../tests/scalar/timedelta/test_arithmetic.py | 3 +-- pandas/tests/series/test_operators.py | 6 ++---- 20 files changed, 33 insertions(+), 77 deletions(-) diff --git a/pandas/tests/arithmetic/test_interval.py b/pandas/tests/arithmetic/test_interval.py index 3e1129b998ddf..50b5fe8e6f6b9 100644 --- a/pandas/tests/arithmetic/test_interval.py +++ b/pandas/tests/arithmetic/test_interval.py @@ -40,8 +40,7 @@ date_range("20170102", periods=3, tz="US/Eastern").insert(4, pd.NaT), ), ], - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda x: str(x[0].dtype), # type: ignore + ids=lambda x: str(x[0].dtype), ) def left_right_dtypes(request): """ @@ -237,8 +236,7 @@ def test_compare_list_like_nan(self, op, array, nulls_fixture, request): pd.array(list("abcd")), pd.array(["foo", 3.14, None, object()]), ], - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda x: str(x.dtype), # type: ignore + ids=lambda x: str(x.dtype), ) def test_compare_list_like_other(self, op, array, other): result = op(array, other) diff --git a/pandas/tests/arithmetic/test_numeric.py b/pandas/tests/arithmetic/test_numeric.py index 5b75d301a443c..678b04b4bdbe6 100644 --- a/pandas/tests/arithmetic/test_numeric.py +++ b/pandas/tests/arithmetic/test_numeric.py @@ -99,10 +99,7 @@ class TestNumericArraylikeArithmeticWithDatetimeLike: # TODO: also check name retentention @pytest.mark.parametrize("box_cls", [np.array, pd.Index, pd.Series]) @pytest.mark.parametrize( - "left", - lefts, - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda x: type(x).__name__ + str(x.dtype), # type: ignore + "left", lefts, ids=lambda x: type(x).__name__ + str(x.dtype) ) def test_mul_td64arr(self, left, box_cls): # GH#22390 @@ -122,10 +119,7 @@ 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, - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda x: type(x).__name__ + str(x.dtype), # type: ignore + "left", lefts, ids=lambda x: type(x).__name__ + str(x.dtype) ) def test_div_td64arr(self, left, box_cls): # GH#22390 @@ -560,16 +554,13 @@ class TestMultiplicationDivision: pytest.param( pd.Index, marks=pytest.mark.xfail( - reason="Index.__div__ always raises", - # https://github.com/pytest-dev/pytest/issues/7488 - raises=TypeError, # type: ignore + reason="Index.__div__ always raises", raises=TypeError ), ), pd.Series, pd.DataFrame, ], - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda x: x.__name__, # type: ignore + ids=lambda x: x.__name__, ) def test_divide_decimal(self, box): # resolves issue GH#9787 diff --git a/pandas/tests/arrays/interval/test_interval.py b/pandas/tests/arrays/interval/test_interval.py index 103a0f4a542aa..d517eaaec68d2 100644 --- a/pandas/tests/arrays/interval/test_interval.py +++ b/pandas/tests/arrays/interval/test_interval.py @@ -28,8 +28,7 @@ date_range("20170102", periods=3, tz="US/Eastern"), ), ], - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda x: str(x[0].dtype), # type: ignore + ids=lambda x: str(x[0].dtype), ) def left_right_dtypes(request): """ diff --git a/pandas/tests/arrays/interval/test_ops.py b/pandas/tests/arrays/interval/test_ops.py index c8e257a4f76af..9c78c2a48b9ff 100644 --- a/pandas/tests/arrays/interval/test_ops.py +++ b/pandas/tests/arrays/interval/test_ops.py @@ -21,8 +21,7 @@ def constructor(request): (Timestamp("2018-01-01"), Timedelta("1 day")), (0, 1), ], - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda x: type(x[0]).__name__, # type: ignore + ids=lambda x: type(x[0]).__name__, ) def start_shift(request): """ diff --git a/pandas/tests/dtypes/test_common.py b/pandas/tests/dtypes/test_common.py index fe04f821af487..ce12718e48d0d 100644 --- a/pandas/tests/dtypes/test_common.py +++ b/pandas/tests/dtypes/test_common.py @@ -156,12 +156,7 @@ def get_is_dtype_funcs(): return [getattr(com, fname) for fname in fnames] -@pytest.mark.parametrize( - "func", - get_is_dtype_funcs(), - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda x: x.__name__, # type: ignore -) +@pytest.mark.parametrize("func", get_is_dtype_funcs(), ids=lambda x: x.__name__) def test_get_dtype_error_catch(func): # see gh-15941 # diff --git a/pandas/tests/extension/test_sparse.py b/pandas/tests/extension/test_sparse.py index 530776b527cf4..68e521b005c02 100644 --- a/pandas/tests/extension/test_sparse.py +++ b/pandas/tests/extension/test_sparse.py @@ -362,8 +362,7 @@ 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) - # https://github.com/pytest-dev/pytest/issues/7488 - @pytest.mark.xfail(raises=TypeError, reason="no sparse StringDtype") # type: ignore + @pytest.mark.xfail(raises=TypeError, reason="no sparse StringDtype") def test_astype_string(self, data): super().test_astype_string(data) diff --git a/pandas/tests/frame/methods/test_diff.py b/pandas/tests/frame/methods/test_diff.py index 0135b3a8dff70..45f134a93a23a 100644 --- a/pandas/tests/frame/methods/test_diff.py +++ b/pandas/tests/frame/methods/test_diff.py @@ -118,8 +118,7 @@ def test_diff_axis(self): @pytest.mark.xfail( reason="GH#32995 needs to operate column-wise or do inference", - # https://github.com/pytest-dev/pytest/issues/7488 - raises=AssertionError, # type: ignore + raises=AssertionError, ) def test_diff_period(self): # GH#32995 Don't pass an incorrect axis diff --git a/pandas/tests/generic/test_finalize.py b/pandas/tests/generic/test_finalize.py index 4b87b9adf9296..4d0f1a326225d 100644 --- a/pandas/tests/generic/test_finalize.py +++ b/pandas/tests/generic/test_finalize.py @@ -535,8 +535,7 @@ def idfn(x): return str(x) -# https://github.com/pytest-dev/pytest/issues/7494 -@pytest.fixture(params=_all_methods, ids=lambda x: idfn(x[-1])) # type: ignore +@pytest.fixture(params=_all_methods, ids=lambda x: idfn(x[-1])) def ndframe_method(request): """ An NDFrame method returning an NDFrame. diff --git a/pandas/tests/indexes/interval/test_indexing.py b/pandas/tests/indexes/interval/test_indexing.py index 3d80251be174b..3abc6e348748a 100644 --- a/pandas/tests/indexes/interval/test_indexing.py +++ b/pandas/tests/indexes/interval/test_indexing.py @@ -95,8 +95,7 @@ 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), ], - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda x: str(x.dtype), # type: ignore + ids=lambda x: str(x.dtype), ) def test_get_loc_datetimelike_nonoverlapping(self, breaks): # GH 20636 @@ -126,8 +125,7 @@ def test_get_loc_datetimelike_nonoverlapping(self, breaks): timedelta_range("2 days", periods=4), ), ], - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda x: str(x[0].dtype), # type: ignore + ids=lambda x: str(x[0].dtype), ) def test_get_loc_datetimelike_overlapping(self, arrays): # GH 20636 @@ -152,8 +150,7 @@ def test_get_loc_datetimelike_overlapping(self, arrays): np.arange(3.0, -1.0, -1.0), np.arange(3, -1, -1), ], - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda x: str(x.dtype), # type: ignore + ids=lambda x: str(x.dtype), ) def test_get_loc_decreasing(self, values): # GH 25860 diff --git a/pandas/tests/indexes/interval/test_interval.py b/pandas/tests/indexes/interval/test_interval.py index 19543857c8c2a..2755b186f3eae 100644 --- a/pandas/tests/indexes/interval/test_interval.py +++ b/pandas/tests/indexes/interval/test_interval.py @@ -323,8 +323,7 @@ def test_get_item(self, closed): date_range("20180101", periods=4, tz="US/Eastern"), timedelta_range("0 days", periods=4), ], - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda x: str(x.dtype), # type: ignore + ids=lambda x: str(x.dtype), ) def test_maybe_convert_i8(self, breaks): # GH 20636 @@ -377,8 +376,7 @@ def test_maybe_convert_i8_nat(self, breaks): @pytest.mark.parametrize( "breaks", [np.arange(5, dtype="int64"), np.arange(5, dtype="float64")], - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda x: str(x.dtype), # type: ignore + ids=lambda x: str(x.dtype), ) @pytest.mark.parametrize( "make_key", @@ -410,8 +408,7 @@ def test_maybe_convert_i8_numeric(self, breaks, make_key): ], 2, ), - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda x: str(x.dtype), # type: ignore + ids=lambda x: str(x.dtype), ) @pytest.mark.parametrize( "make_key", diff --git a/pandas/tests/indexes/multi/test_analytics.py b/pandas/tests/indexes/multi/test_analytics.py index c6b0c67476603..9e4e73e793bac 100644 --- a/pandas/tests/indexes/multi/test_analytics.py +++ b/pandas/tests/indexes/multi/test_analytics.py @@ -234,8 +234,7 @@ def test_map_dictlike(idx, mapper): np.deg2rad, np.rad2deg, ], - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda func: func.__name__, # type: ignore + ids=lambda func: func.__name__, ) def test_numpy_ufuncs(idx, func): # test ufuncs of numpy. see: @@ -257,8 +256,7 @@ def test_numpy_ufuncs(idx, func): @pytest.mark.parametrize( "func", [np.isfinite, np.isinf, np.isnan, np.signbit], - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda func: func.__name__, # type: ignore + ids=lambda func: func.__name__, ) def test_numpy_type_funcs(idx, func): msg = ( diff --git a/pandas/tests/indexes/test_engines.py b/pandas/tests/indexes/test_engines.py index 092fc829f0be6..9ea70a457e516 100644 --- a/pandas/tests/indexes/test_engines.py +++ b/pandas/tests/indexes/test_engines.py @@ -22,8 +22,7 @@ (libindex.Float64Engine, np.float64), (libindex.Float32Engine, np.float32), ], - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda x: x[0].__name__, # type: ignore + ids=lambda x: x[0].__name__, ) def numeric_indexing_engine_type_and_dtype(request): return request.param diff --git a/pandas/tests/indexes/test_numpy_compat.py b/pandas/tests/indexes/test_numpy_compat.py index 92f872880bc28..043539c173427 100644 --- a/pandas/tests/indexes/test_numpy_compat.py +++ b/pandas/tests/indexes/test_numpy_compat.py @@ -42,8 +42,7 @@ np.deg2rad, np.rad2deg, ], - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda x: x.__name__, # type: ignore + ids=lambda x: x.__name__, ) def test_numpy_ufuncs_basic(index, func): # test ufuncs of numpy, see: @@ -73,10 +72,7 @@ def test_numpy_ufuncs_basic(index, func): @pytest.mark.parametrize( - "func", - [np.isfinite, np.isinf, np.isnan, np.signbit], - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda x: x.__name__, # type: ignore + "func", [np.isfinite, np.isinf, np.isnan, np.signbit], ids=lambda x: x.__name__ ) def test_numpy_ufuncs_other(index, func): # test ufuncs of numpy, see: diff --git a/pandas/tests/internals/test_internals.py b/pandas/tests/internals/test_internals.py index 12d63c12cdfae..06ccdd2484a2a 100644 --- a/pandas/tests/internals/test_internals.py +++ b/pandas/tests/internals/test_internals.py @@ -1132,8 +1132,7 @@ def test_datetime_block_can_hold_element(self): operator.mod, operator.pow, ], - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda x: x.__name__, # type: ignore + ids=lambda x: x.__name__, ) def test_binop_other(self, op, value, dtype): skip = { diff --git a/pandas/tests/plotting/test_frame.py b/pandas/tests/plotting/test_frame.py index 86631fb789399..3d85e79b15c4c 100644 --- a/pandas/tests/plotting/test_frame.py +++ b/pandas/tests/plotting/test_frame.py @@ -2696,8 +2696,7 @@ def test_errorbar_plot(self): with pytest.raises((ValueError, TypeError)): df.plot(yerr=df_err) - # https://github.com/pytest-dev/pytest/issues/7488 - @pytest.mark.xfail(reason="Iterator is consumed", raises=ValueError) # type: ignore + @pytest.mark.xfail(reason="Iterator is consumed", raises=ValueError) @pytest.mark.slow def test_errorbar_plot_iterator(self): with warnings.catch_warnings(): diff --git a/pandas/tests/reshape/merge/test_merge.py b/pandas/tests/reshape/merge/test_merge.py index cac8c0c46c24c..4fd3c688b8771 100644 --- a/pandas/tests/reshape/merge/test_merge.py +++ b/pandas/tests/reshape/merge/test_merge.py @@ -66,8 +66,7 @@ def get_series_na(): ] -# https://github.com/pytest-dev/pytest/issues/7494 -@pytest.fixture(params=get_series(), ids=lambda x: x.dtype.name) # type: ignore +@pytest.fixture(params=get_series(), ids=lambda x: x.dtype.name) def series_of_dtype(request): """ A parametrized fixture returning a variety of Series of different @@ -76,8 +75,7 @@ def series_of_dtype(request): return request.param -# https://github.com/pytest-dev/pytest/issues/7494 -@pytest.fixture(params=get_series(), ids=lambda x: x.dtype.name) # type: ignore +@pytest.fixture(params=get_series(), ids=lambda x: x.dtype.name) def series_of_dtype2(request): """ A duplicate of the series_of_dtype fixture, so that it can be used @@ -86,8 +84,7 @@ def series_of_dtype2(request): return request.param -# https://github.com/pytest-dev/pytest/issues/7494 -@pytest.fixture(params=get_series_na(), ids=lambda x: x.dtype.name) # type: ignore +@pytest.fixture(params=get_series_na(), ids=lambda x: x.dtype.name) def series_of_dtype_all_na(request): """ A parametrized fixture returning a variety of Series with all NA diff --git a/pandas/tests/reshape/test_qcut.py b/pandas/tests/reshape/test_qcut.py index c1bf1e1ba6274..c436ab5d90578 100644 --- a/pandas/tests/reshape/test_qcut.py +++ b/pandas/tests/reshape/test_qcut.py @@ -210,8 +210,7 @@ def test_single_quantile(data, start, end, length, labels): Series(DatetimeIndex(["20180101", NaT, "20180103"])), Series(TimedeltaIndex(["0 days", NaT, "2 days"])), ], - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda x: str(x.dtype), # type: ignore + ids=lambda x: str(x.dtype), ) def test_qcut_nat(ser): # see gh-19768 diff --git a/pandas/tests/scalar/interval/test_ops.py b/pandas/tests/scalar/interval/test_ops.py index ae60039d81f9f..2d9f0954af5a8 100644 --- a/pandas/tests/scalar/interval/test_ops.py +++ b/pandas/tests/scalar/interval/test_ops.py @@ -10,8 +10,7 @@ (Timestamp("2018-01-01"), Timedelta("1 day")), (0, 1), ], - # https://github.com/pytest-dev/pytest/issues/7494 - ids=lambda x: type(x[0]).__name__, # type: ignore + ids=lambda x: type(x[0]).__name__, ) def start_shift(request): """ diff --git a/pandas/tests/scalar/timedelta/test_arithmetic.py b/pandas/tests/scalar/timedelta/test_arithmetic.py index 0f17aa1f8b67b..cb33f99d9bd91 100644 --- a/pandas/tests/scalar/timedelta/test_arithmetic.py +++ b/pandas/tests/scalar/timedelta/test_arithmetic.py @@ -427,8 +427,7 @@ def test_td_div_numeric_scalar(self): marks=pytest.mark.xfail( # Works on numpy dev only in python 3.9 _is_numpy_dev and not compat.PY39, - # https://github.com/pytest-dev/pytest/issues/7488 - raises=RuntimeWarning, # type: ignore + raises=RuntimeWarning, reason="https://github.com/pandas-dev/pandas/issues/31992", ), ), diff --git a/pandas/tests/series/test_operators.py b/pandas/tests/series/test_operators.py index a0381976ab61e..e1c9682329271 100644 --- a/pandas/tests/series/test_operators.py +++ b/pandas/tests/series/test_operators.py @@ -333,8 +333,7 @@ def test_reversed_xor_with_index_returns_index(self): ops.rand_, marks=pytest.mark.xfail( reason="GH#22092 Index __and__ returns Index intersection", - # https://github.com/pytest-dev/pytest/issues/7488 - raises=AssertionError, # type: ignore + raises=AssertionError, strict=True, ), ), @@ -342,8 +341,7 @@ def test_reversed_xor_with_index_returns_index(self): ops.ror_, marks=pytest.mark.xfail( reason="GH#22092 Index __or__ returns Index union", - # https://github.com/pytest-dev/pytest/issues/7488 - raises=AssertionError, # type: ignore + raises=AssertionError, strict=True, ), ), From 24947db9e3b3446533a8ddf12c870a9fa1150b35 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Wed, 29 Jul 2020 11:15:42 +0100 Subject: [PATCH 13/17] pytest 6.0.0 released --- environment.yml | 8 ++++---- requirements-dev.txt | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/environment.yml b/environment.yml index a5b844bf8318c..ab26a03f9e482 100644 --- a/environment.yml +++ b/environment.yml @@ -52,6 +52,10 @@ dependencies: - botocore>=1.11 - hypothesis>=3.82 - moto # mock S3 + - pytest>=6.0.0 + - pytest-cov + - pytest-xdist>=1.21 + - pytest-asyncio # downstream tests - seaborn @@ -105,7 +109,3 @@ dependencies: - pip: - git+https://github.com/pandas-dev/pydata-sphinx-theme.git@master - git+https://github.com/numpy/numpydoc - - git+https://github.com/pytest-dev/pytest@master - - pytest-cov - - pytest-xdist>=1.21 - - pytest-asyncio diff --git a/requirements-dev.txt b/requirements-dev.txt index 16dfb56ec8b22..e6450f69be602 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -32,6 +32,10 @@ boto3 botocore>=1.11 hypothesis>=3.82 moto +pytest>=6.0.0 +pytest-cov +pytest-xdist>=1.21 +pytest-asyncio seaborn statsmodels ipywidgets @@ -69,8 +73,4 @@ cftime pyreadstat tabulate>=0.8.3 git+https://github.com/pandas-dev/pydata-sphinx-theme.git@master -git+https://github.com/numpy/numpydoc -git+https://github.com/pytest-dev/pytest@master -pytest-cov -pytest-xdist>=1.21 -pytest-asyncio \ No newline at end of file +git+https://github.com/numpy/numpydoc \ No newline at end of file From c39a53170d6b4f9dbe30bc8de3fbb2a462d8df5b Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Wed, 29 Jul 2020 14:58:28 +0100 Subject: [PATCH 14/17] rogue diff --- pandas/tests/arithmetic/test_numeric.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/tests/arithmetic/test_numeric.py b/pandas/tests/arithmetic/test_numeric.py index 678b04b4bdbe6..2155846b271fc 100644 --- a/pandas/tests/arithmetic/test_numeric.py +++ b/pandas/tests/arithmetic/test_numeric.py @@ -99,7 +99,7 @@ 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, ids=lambda x: type(x).__name__ + str(x.dtype), ) def test_mul_td64arr(self, left, box_cls): # GH#22390 @@ -119,7 +119,7 @@ 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, ids=lambda x: type(x).__name__ + str(x.dtype), ) def test_div_td64arr(self, left, box_cls): # GH#22390 From 86d3c3ce4b8a486a0c35a257135965b16ccfe596 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Wed, 29 Jul 2020 15:02:16 +0100 Subject: [PATCH 15/17] remove ignores --- pandas/tests/groupby/test_categorical.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/pandas/tests/groupby/test_categorical.py b/pandas/tests/groupby/test_categorical.py index d4dd22a55e472..c53c0ea05304b 100644 --- a/pandas/tests/groupby/test_categorical.py +++ b/pandas/tests/groupby/test_categorical.py @@ -1294,13 +1294,10 @@ def test_get_nonexistent_category(): ) -def test_series_groupby_on_2_categoricals_unobserved( - reduction_func: str, observed: bool, request -): +def test_series_groupby_on_2_categoricals_unobserved(reduction_func, observed, request): # GH 17605 if reduction_func == "ngroup": - # https://github.com/pytest-dev/pytest/issues/7495 - pytest.skip("ngroup is not truly a reduction") # type: ignore + pytest.skip("ngroup is not truly a reduction") if reduction_func == "corrwith": # GH 32293 mark = pytest.mark.xfail( @@ -1327,14 +1324,13 @@ def test_series_groupby_on_2_categoricals_unobserved( def test_series_groupby_on_2_categoricals_unobserved_zeroes_or_nans( - reduction_func: str, request + reduction_func, request ): # GH 17605 # Tests whether the unobserved categories in the result contain 0 or NaN if reduction_func == "ngroup": - # https://github.com/pytest-dev/pytest/issues/7495 - pytest.skip("ngroup is not truly a reduction") # type: ignore + pytest.skip("ngroup is not truly a reduction") if reduction_func == "corrwith": # GH 32293 mark = pytest.mark.xfail( @@ -1376,14 +1372,13 @@ def test_series_groupby_on_2_categoricals_unobserved_zeroes_or_nans( assert np.issubdtype(result.dtype, np.integer) -def test_dataframe_groupby_on_2_categoricals_when_observed_is_true(reduction_func: str): +def test_dataframe_groupby_on_2_categoricals_when_observed_is_true(reduction_func): # GH 23865 # GH 27075 # 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": - # https://github.com/pytest-dev/pytest/issues/7495 - pytest.skip("ngroup does not return the Categories on the index") # type: ignore # noqa: E501 + pytest.skip("ngroup does not return the Categories on the index") df = pd.DataFrame( { @@ -1413,8 +1408,7 @@ 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": - # https://github.com/pytest-dev/pytest/issues/7495 - pytest.skip("ngroup does not return the Categories on the index") # type: ignore # noqa:E501 + pytest.skip("ngroup does not return the Categories on the index") if reduction_func == "count": # GH 35028 mark = pytest.mark.xfail( From a34d3e9329a8cd62ce680309639f79f14785873f Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Wed, 29 Jul 2020 15:23:27 +0100 Subject: [PATCH 16/17] missed one --- pandas/tests/groupby/test_categorical.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/groupby/test_categorical.py b/pandas/tests/groupby/test_categorical.py index c53c0ea05304b..0d447a70b540d 100644 --- a/pandas/tests/groupby/test_categorical.py +++ b/pandas/tests/groupby/test_categorical.py @@ -1400,7 +1400,7 @@ def test_dataframe_groupby_on_2_categoricals_when_observed_is_true(reduction_fun @pytest.mark.parametrize("observed", [False, None]) def test_dataframe_groupby_on_2_categoricals_when_observed_is_false( - reduction_func: str, observed: bool, request + reduction_func, observed, request ): # GH 23865 # GH 27075 From 7dcb82f2f4e56a8d9d562469cd4b0261862a4399 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Wed, 29 Jul 2020 15:26:42 +0100 Subject: [PATCH 17/17] update environment.yml --- environment.yml | 2 +- requirements-dev.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index ab26a03f9e482..3b088ca511be9 100644 --- a/environment.yml +++ b/environment.yml @@ -52,7 +52,7 @@ dependencies: - botocore>=1.11 - hypothesis>=3.82 - moto # mock S3 - - pytest>=6.0.0 + - pytest>=5.0.1 - pytest-cov - pytest-xdist>=1.21 - pytest-asyncio diff --git a/requirements-dev.txt b/requirements-dev.txt index e6450f69be602..7bf3df176b378 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -32,7 +32,7 @@ boto3 botocore>=1.11 hypothesis>=3.82 moto -pytest>=6.0.0 +pytest>=5.0.1 pytest-cov pytest-xdist>=1.21 pytest-asyncio