Skip to content
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

CI: Unpin pytest #35272

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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/deps/azure-36-32bit.yaml
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
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
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-slow.yaml
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
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
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
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
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
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
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
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
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
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
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
8 changes: 4 additions & 4 deletions environment.yml
Expand Up @@ -51,10 +51,6 @@ dependencies:
- botocore>=1.11
- hypothesis>=3.82
- moto # mock S3
- pytest>=5.0.1,<6.0.0rc0
- pytest-cov
- pytest-xdist>=1.21
- pytest-asyncio

# downstream tests
- seaborn
Expand Down Expand Up @@ -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
6 changes: 2 additions & 4 deletions pandas/_testing.py
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
4 changes: 2 additions & 2 deletions pandas/tests/arithmetic/test_numeric.py
Expand Up @@ -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)
simonjayhawkins marked this conversation as resolved.
Show resolved Hide resolved
)
def test_mul_td64arr(self, left, box_cls):
# GH#22390
Expand All @@ -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
Expand Down
12 changes: 8 additions & 4 deletions pandas/tests/groupby/test_categorical.py
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

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
18 changes: 10 additions & 8 deletions pandas/util/_test_decorators.py
Expand Up @@ -120,7 +120,9 @@ def _skip_if_no_scipy() -> bool:
)


def skip_if_installed(package: str) -> Callable:
# 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.

Expand All @@ -134,7 +136,9 @@ def skip_if_installed(package: str) -> Callable:
)


def skip_if_no(package: str, min_version: Optional[str] = None) -> Callable:
# 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.
Expand Down Expand Up @@ -196,14 +200,12 @@ 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:
# 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), reason=reason, *args, **kwds
)
return pytest.mark.skipif(_np_version < LooseVersion(ver_str), *args, reason=reason)


def parametrize_fixture_doc(*args):
Expand Down
10 changes: 5 additions & 5 deletions requirements-dev.txt
Expand Up @@ -32,10 +32,6 @@ boto3
botocore>=1.11
hypothesis>=3.82
moto
pytest>=5.0.1,<6.0.0rc0
pytest-cov
pytest-xdist>=1.21
pytest-asyncio
seaborn
statsmodels
ipywidgets
Expand Down Expand Up @@ -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
git+https://github.com/numpy/numpydoc
git+https://github.com/pytest-dev/pytest@master
pytest-cov
pytest-xdist>=1.21
pytest-asyncio
2 changes: 1 addition & 1 deletion setup.cfg
Expand Up @@ -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
Expand Down