fix test with latest pytest

(cherry picked from commit dc788c8554ddce915a49aa2233c8efa4dbccfaab)
This commit is contained in:
Funda Wang 2025-01-28 14:23:48 +08:00 committed by openeuler-sync-bot
parent 69eebea641
commit 7062fb77a9
3 changed files with 50 additions and 6 deletions

View File

@ -0,0 +1,40 @@
From b9084fab02c009a593b604562a69f36a5915c8e5 Mon Sep 17 00:00:00 2001
From: Denis Laxalde <denis@laxalde.org>
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 <hs@ox.cx>
---
tests/test_funcs.py | 4 +---
1 files changed, 1 insertion, 3 deletions(-)
diff --git a/tests/test_funcs.py b/tests/test_funcs.py
index 044aaab2c..398ba3576 100644
--- a/tests/test_funcs.py
+++ b/tests/test_funcs.py
@@ -600,9 +600,7 @@ def test_unknown(self, C):
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

View File

@ -9,10 +9,11 @@ object protocols. \
Name: python-attrs
Summary: Python attributes without boilerplate
Version: 23.2.0
Release: 1
Release: 2
License: MIT
URL: http://www.attrs.org/
Source0: https://github.com/hynek/attrs/archive/%{version}/attrs-%{version}.tar.gz
URL: https://www.attrs.org/
Source0: https://github.com/python-attrs/attrs/archive/%{version}/attrs-%{version}.tar.gz
Patch6001: backport-Remove-pytest-deprecated_call.patch
BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: python%{python3_pkgversion}-devel
@ -60,6 +61,9 @@ PYTHONPATH=$RPM_BUILD_ROOT/%{python3_sitelib} py.test-3 -v
%doc README.md
%changelog
* Tue Jan 28 2025 Funda Wang <fundawang@yeah.net> - 23.2.0-2
- fix test with latest pytest
* Mon Jan 29 2024 weihaohao <weihaohao2@huawei.com> - 23.2.0-1
- Update package to version 23.2.0

View File

@ -1,4 +1,4 @@
version_control: github
src_repo: hynek/attrs
tag_prefix: "^v"
seperator: "."
src_repo: python-attrs/attrs
tag_prefix:
separator: "."