commit:     9d50af73c819aaf6efc84a954dc8cb42a70bed8c
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 28 12:23:51 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Mar 28 12:26:51 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9d50af73

dev-python/tavern: Fix test failures with pytest-8

Closes: https://bugs.gentoo.org/928007
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../tavern/files/tavern-2.10.1-pytest-8.patch      | 36 ++++++++++++++++++++++
 dev-python/tavern/tavern-2.10.1.ebuild             |  5 +++
 2 files changed, 41 insertions(+)

diff --git a/dev-python/tavern/files/tavern-2.10.1-pytest-8.patch 
b/dev-python/tavern/files/tavern-2.10.1-pytest-8.patch
new file mode 100644
index 000000000000..6820164b50e1
--- /dev/null
+++ b/dev-python/tavern/files/tavern-2.10.1-pytest-8.patch
@@ -0,0 +1,36 @@
+From 3aa8cc92e474e91c2a4014b4b4ec2f1e4b2e620a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]>
+Date: Thu, 28 Mar 2024 13:20:00 +0100
+Subject: [PATCH] Replace deprecated `pytest.warns(None)`
+
+Replace the deprecated `pytest.warns(None)` use with the `error` warning
+filter, as recommended
+in https://github.com/pytest-dev/pytest/issues/9404#issue-1076710891.
+With this change, the tests pass with pytest-8.1.1.
+---
+ tests/unit/test_call_run.py | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/tests/unit/test_call_run.py b/tests/unit/test_call_run.py
+index 30972c1a..88a72714 100644
+--- a/tests/unit/test_call_run.py
++++ b/tests/unit/test_call_run.py
+@@ -1,3 +1,4 @@
++import warnings
+ from unittest.mock import patch
+ 
+ import pytest
+@@ -35,11 +36,10 @@ def test_run_with_cfg(self):
+     )
+     def test_doesnt_warn_about_expected_kwargs(self, expected_kwarg):
+         kw = {expected_kwarg: 123}
+-        with pytest.warns(None) as warn_rec:
++        with warnings.catch_warnings():
++            warnings.simplefilter("error")
+             run("", **kw)
+ 
+-        assert not len(warn_rec)
+-
+ 
+ class TestParseGlobalCfg:
+     def test_path_correct(self):

diff --git a/dev-python/tavern/tavern-2.10.1.ebuild 
b/dev-python/tavern/tavern-2.10.1.ebuild
index 74fcee9d1337..ee97b4e46bab 100644
--- a/dev-python/tavern/tavern-2.10.1.ebuild
+++ b/dev-python/tavern/tavern-2.10.1.ebuild
@@ -44,6 +44,11 @@ BDEPEND="
 distutils_enable_tests pytest
 
 src_prepare() {
+       local PATCHES=(
+               # https://github.com/taverntesting/tavern/pull/922
+               "${FILESDIR}/${P}-pytest-8.patch"
+       )
+
        # strip unnecessary pins, upstream doesn't update them a lot
        sed -i -E -e 's:,?<=?[0-9.]+::' pyproject.toml || die
        distutils-r1_src_prepare

Reply via email to