From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B56DF15838C for ; Wed, 31 Jan 2024 12:00:14 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E61442BC022; Wed, 31 Jan 2024 12:00:13 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C48812BC022 for ; Wed, 31 Jan 2024 12:00:13 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B099B34308A for ; Wed, 31 Jan 2024 12:00:12 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 152B5105D for ; Wed, 31 Jan 2024 12:00:11 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1706702407.a67ced94919a812b36395f59069928082dc1e56c.mgorny@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/xarray/, dev-python/xarray/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-python/xarray/files/xarray-2024.1.1-pytest-8.patch dev-python/xarray/xarray-2024.1.1.ebuild X-VCS-Directories: dev-python/xarray/ dev-python/xarray/files/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: a67ced94919a812b36395f59069928082dc1e56c X-VCS-Branch: master Date: Wed, 31 Jan 2024 12:00:11 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: be774bd4-59c1-4150-8542-eaf1fbb9ebed X-Archives-Hash: 54b5020bd4969cc58b05bfa4efde6d7b commit: a67ced94919a812b36395f59069928082dc1e56c Author: Michał Górny gentoo org> AuthorDate: Wed Jan 31 11:59:48 2024 +0000 Commit: Michał Górny gentoo org> CommitDate: Wed Jan 31 12:00:07 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a67ced94 dev-python/xarray: Add a pytest-8 patch Closes: https://bugs.gentoo.org/923318 Signed-off-by: Michał Górny gentoo.org> .../xarray/files/xarray-2024.1.1-pytest-8.patch | 77 ++++++++++++++++++++++ dev-python/xarray/xarray-2024.1.1.ebuild | 41 +++++++----- 2 files changed, 100 insertions(+), 18 deletions(-) diff --git a/dev-python/xarray/files/xarray-2024.1.1-pytest-8.patch b/dev-python/xarray/files/xarray-2024.1.1-pytest-8.patch new file mode 100644 index 000000000000..e85bb6de7b71 --- /dev/null +++ b/dev-python/xarray/files/xarray-2024.1.1-pytest-8.patch @@ -0,0 +1,77 @@ +From 306a50e344522a3f321d49d95488f457975fa553 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Wed, 31 Jan 2024 11:31:26 +0100 +Subject: [PATCH 1/2] test_dataset: remove incorrect pytest.warns() to fix + pytest-8 + +Remove two incorrect `pytest.warns()` assertions to fix test failures +with pytest-8.0.0. Prior to this version, an exception raised would +cause `pytest.warns()` to be ignored. This way fixed in 8.0.0, and now +warnings must actually be emitted prior to the exception. + +In `test_drop_index_labels()`, the exception is raised at the very +beginning of the function, prior to the deprecation warning. + +In `test_rename_multiindex()`, the warning is not emitted at all (it is +not applicable to the call in question). +--- + xarray/tests/test_dataset.py | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/xarray/tests/test_dataset.py b/xarray/tests/test_dataset.py +index fa9448f2f4..77d172f00b 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 + +From 3bc5abf4da35edda1f0c3e9e0d53e39331c1a76b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Wed, 31 Jan 2024 11:35:04 +0100 +Subject: [PATCH 2/2] test_groupby: Clear recorded warnings for pytest-8 + compatibility + +Clear the warnings recorded during the `pytest.warns()` use +in `test_groupby_dims_property`, to fix test failures with pytest-8.0.0. +Prior to this version, `pytest.warns()` invocation used to capture all +warnings. Now it only captures the warnings that match the arguments, +and the remaining warnings are re-emitted and therefore caught by +`recwarn` fixture. To provide compatibility with both versions of +pytest, clear the recorded warnings immediately after `pytest.warns()`. + +Fixes #8681 +--- + xarray/tests/test_groupby.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/xarray/tests/test_groupby.py b/xarray/tests/test_groupby.py +index 25fabd5e2b..b65c01fe76 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( diff --git a/dev-python/xarray/xarray-2024.1.1.ebuild b/dev-python/xarray/xarray-2024.1.1.ebuild index 28602ca801b2..7d7d2b998d10 100644 --- a/dev-python/xarray/xarray-2024.1.1.ebuild +++ b/dev-python/xarray/xarray-2024.1.1.ebuild @@ -40,27 +40,32 @@ BDEPEND=" EPYTEST_XDIST=1 distutils_enable_tests pytest -EPYTEST_DESELECT=( - # warning-targeted tests are fragile and not important to end users - xarray/tests/test_backends.py::test_no_warning_from_dask_effective_get - # TODO: segv in netcdf4-python - 'xarray/tests/test_backends.py::test_open_mfdataset_manyfiles[netcdf4-20-True-5-5]' - 'xarray/tests/test_backends.py::test_open_mfdataset_manyfiles[netcdf4-20-True-5-None]' - 'xarray/tests/test_backends.py::test_open_mfdataset_manyfiles[netcdf4-20-True-None-5]' - 'xarray/tests/test_backends.py::test_open_mfdataset_manyfiles[netcdf4-20-True-None-None]' - xarray/tests/test_backends.py::TestDask::test_save_mfdataset_compute_false_roundtrip - # TODO: broken - xarray/tests/test_backends.py::TestNetCDF4Data - xarray/tests/test_backends.py::TestNetCDF4ViaDaskData - # hangs - xarray/tests/test_backends.py::TestDask::test_dask_roundtrip - # mismatches when pyarrow is installed - # https://github.com/pydata/xarray/issues/8092 - xarray/tests/test_dask.py::TestToDaskDataFrame::test_to_dask_dataframe_2D - xarray/tests/test_dask.py::TestToDaskDataFrame::test_to_dask_dataframe_not_daskarray +PATCHES=( + # https://github.com/pydata/xarray/pull/8686 + "${FILESDIR}/${P}-pytest-8.patch" ) python_test() { + local EPYTEST_DESELECT=( + # warning-targeted tests are fragile and not important to end users + xarray/tests/test_backends.py::test_no_warning_from_dask_effective_get + # TODO: segv in netcdf4-python + 'xarray/tests/test_backends.py::test_open_mfdataset_manyfiles[netcdf4-20-True-5-5]' + 'xarray/tests/test_backends.py::test_open_mfdataset_manyfiles[netcdf4-20-True-5-None]' + 'xarray/tests/test_backends.py::test_open_mfdataset_manyfiles[netcdf4-20-True-None-5]' + 'xarray/tests/test_backends.py::test_open_mfdataset_manyfiles[netcdf4-20-True-None-None]' + xarray/tests/test_backends.py::TestDask::test_save_mfdataset_compute_false_roundtrip + # TODO: broken + xarray/tests/test_backends.py::TestNetCDF4Data + xarray/tests/test_backends.py::TestNetCDF4ViaDaskData + # hangs + xarray/tests/test_backends.py::TestDask::test_dask_roundtrip + # mismatches when pyarrow is installed + # https://github.com/pydata/xarray/issues/8092 + xarray/tests/test_dask.py::TestToDaskDataFrame::test_to_dask_dataframe_2D + xarray/tests/test_dask.py::TestToDaskDataFrame::test_to_dask_dataframe_not_daskarray + ) + local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 if ! has_version ">=dev-python/scipy-1.4[${PYTHON_USEDEP}]" ; then