commit:     ae8b818f4e783c967ecad84ed49e86b80659bbb9
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Apr  1 14:16:57 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Apr  1 14:44:20 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ae8b818f

dev-python/attrs: Fix test failure with pytest-8

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

 dev-python/attrs/attrs-23.2.0.ebuild               |  5 +++
 dev-python/attrs/files/attrs-23.2.0-pytest-8.patch | 44 ++++++++++++++++++++++
 2 files changed, 49 insertions(+)

diff --git a/dev-python/attrs/attrs-23.2.0.ebuild 
b/dev-python/attrs/attrs-23.2.0.ebuild
index a0aa7acc3ff7..5c18c763b029 100644
--- a/dev-python/attrs/attrs-23.2.0.ebuild
+++ b/dev-python/attrs/attrs-23.2.0.ebuild
@@ -33,3 +33,8 @@ BDEPEND="
 "
 
 distutils_enable_tests pytest
+
+PATCHES=(
+       # https://github.com/python-attrs/attrs/pull/1249
+       "${FILESDIR}/${P}-pytest-8.patch"
+)

diff --git a/dev-python/attrs/files/attrs-23.2.0-pytest-8.patch 
b/dev-python/attrs/files/attrs-23.2.0-pytest-8.patch
new file mode 100644
index 000000000000..68e4c86c1315
--- /dev/null
+++ b/dev-python/attrs/files/attrs-23.2.0-pytest-8.patch
@@ -0,0 +1,44 @@
+From b9084fab02c009a593b604562a69f36a5915c8e5 Mon Sep 17 00:00:00 2001
+From: Denis Laxalde <[email protected]>
+Date: Sat, 2 Mar 2024 07:40:36 +0100
+Subject: [PATCH] Remove pytest.deprecated_call() in TestAssoc::test_unknown
+ (#1249)
+
+assoc() no longer raises a deprecation warning since commit
+22ae8473fb88d6e585b05c709e81e1a46398a649 but the 'with
+pytest.deprecated_call():' in that test was not removed then (in
+contrast with other test cases).
+
+Maybe this got unnoticed due to a pytest bug?
+In any case, using pytest 8+ (and keeping deprecated_call()) shows that
+no warning is raised and the test fails.
+
+Removing the upper bound on pytest in dev dependencies as tests now
+pass with pytest 8.0.
+
+Fix #1233.
+
+Co-authored-by: Hynek Schlawack <[email protected]>
+---
+ pyproject.toml      | 3 +--
+ tests/test_funcs.py | 4 +---
+ 2 files changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/tests/test_funcs.py b/tests/test_funcs.py
+index 044aaab..398ba35 100644
+--- a/tests/test_funcs.py
++++ b/tests/test_funcs.py
+@@ -600,9 +600,7 @@ class TestAssoc:
+         AttrsAttributeNotFoundError.
+         """
+         # No generated class will have a four letter attribute.
+-        with pytest.raises(
+-            AttrsAttributeNotFoundError
+-        ) as e, pytest.deprecated_call():
++        with pytest.raises(AttrsAttributeNotFoundError) as e:
+             assoc(C(), aaaa=2)
+ 
+         assert (f"aaaa is not an attrs attribute on {C!r}.",) == e.value.args
+-- 
+2.44.0
+

Reply via email to