diff --git a/ci/requirements/all-but-dask.yml b/ci/requirements/all-but-dask.yml index 404b77ae78d..c16c174ff96 100644 --- a/ci/requirements/all-but-dask.yml +++ b/ci/requirements/all-but-dask.yml @@ -27,7 +27,7 @@ dependencies: - pint>=0.22 - pip - pydap - - pytest==7.4.* + - pytest - pytest-cov - pytest-env - pytest-xdist diff --git a/ci/requirements/bare-minimum.yml b/ci/requirements/bare-minimum.yml index 7852e182eb8..56af319f0bb 100644 --- a/ci/requirements/bare-minimum.yml +++ b/ci/requirements/bare-minimum.yml @@ -6,7 +6,7 @@ dependencies: - python=3.9 - coveralls - pip - - pytest==7.4.* + - pytest - pytest-cov - pytest-env - pytest-xdist diff --git a/ci/requirements/environment-3.12.yml b/ci/requirements/environment-3.12.yml index 736c1599158..77b531951d9 100644 --- a/ci/requirements/environment-3.12.yml +++ b/ci/requirements/environment-3.12.yml @@ -33,7 +33,7 @@ dependencies: - pooch - pre-commit - pydap - - pytest==7.4.* + - pytest - pytest-cov - pytest-env - pytest-xdist diff --git a/ci/requirements/environment-windows-3.12.yml b/ci/requirements/environment-windows-3.12.yml index 96945769618..a9424d71de2 100644 --- a/ci/requirements/environment-windows-3.12.yml +++ b/ci/requirements/environment-windows-3.12.yml @@ -28,7 +28,7 @@ dependencies: - pip - pre-commit - pydap - - pytest==7.4.* + - pytest - pytest-cov - pytest-env - pytest-xdist diff --git a/ci/requirements/environment-windows.yml b/ci/requirements/environment-windows.yml index 14f3e8968b3..2a5a4bc86a5 100644 --- a/ci/requirements/environment-windows.yml +++ b/ci/requirements/environment-windows.yml @@ -28,7 +28,7 @@ dependencies: - pip - pre-commit - pydap - - pytest==7.4.* + - pytest - pytest-cov - pytest-env - pytest-xdist diff --git a/ci/requirements/environment.yml b/ci/requirements/environment.yml index f6f60928c00..f2304ce62ca 100644 --- a/ci/requirements/environment.yml +++ b/ci/requirements/environment.yml @@ -34,7 +34,7 @@ dependencies: - pre-commit - pyarrow # pandas makes a deprecation warning without this, breaking doctests - pydap - - pytest==7.4.* + - pytest - pytest-cov - pytest-env - pytest-xdist diff --git a/ci/requirements/min-all-deps.yml b/ci/requirements/min-all-deps.yml index 7a60f7376c9..775c98b83b7 100644 --- a/ci/requirements/min-all-deps.yml +++ b/ci/requirements/min-all-deps.yml @@ -42,7 +42,7 @@ dependencies: - pint=0.22 - pip - pydap=3.3 - - pytest==7.4.* + - pytest - pytest-cov - pytest-env - pytest-xdist diff --git a/xarray/tests/test_dataset.py b/xarray/tests/test_dataset.py index fa9448f2f41..77d172f00b8 100644 --- a/xarray/tests/test_dataset.py +++ b/xarray/tests/test_dataset.py @@ -2724,8 +2724,7 @@ def test_drop_index_labels(self) -> None: assert_identical(data, actual) with pytest.raises(ValueError): - with pytest.warns(DeprecationWarning): - data.drop(["c"], dim="x", errors="wrong_value") # type: ignore[arg-type] + data.drop(["c"], dim="x", errors="wrong_value") # type: ignore[arg-type] with pytest.warns(DeprecationWarning): actual = data.drop(["a", "b", "c"], "x", errors="ignore") @@ -3159,8 +3158,7 @@ def test_rename_multiindex(self) -> None: original.rename({"a": "x"}) with pytest.raises(ValueError, match=r"'b' conflicts"): - with pytest.warns(UserWarning, match="does not create an index anymore"): - original.rename({"a": "b"}) + original.rename({"a": "b"}) def test_rename_perserve_attrs_encoding(self) -> None: # test propagate attrs/encoding to new variable(s) created from Index object diff --git a/xarray/tests/test_groupby.py b/xarray/tests/test_groupby.py index 25fabd5e2b9..b65c01fe76d 100644 --- a/xarray/tests/test_groupby.py +++ b/xarray/tests/test_groupby.py @@ -67,6 +67,8 @@ def test_groupby_dims_property(dataset, recwarn) -> None: with pytest.warns(UserWarning, match="The `squeeze` kwarg"): assert dataset.groupby("x").dims == dataset.isel(x=1).dims assert dataset.groupby("y").dims == dataset.isel(y=1).dims + # in pytest-8, pytest.warns() no longer clears all warnings + recwarn.clear() # when squeeze=False, no warning should be raised assert tuple(dataset.groupby("x", squeeze=False).dims) == tuple(