Fix tests with Python 3.10

This commit is contained in:
Lumir Balhar 2021-05-05 10:49:40 +02:00
parent 471a9b9b64
commit 9e63202c5e
2 changed files with 51 additions and 1 deletions

View File

@ -0,0 +1,41 @@
From 2d150df7974a4a97ba3cbaec5a838f019882b527 Mon Sep 17 00:00:00 2001
From: Lumir Balhar <lbalhar@redhat.com>
Date: Wed, 5 May 2021 10:36:09 +0200
Subject: [PATCH] Fix tests with Python 3.10
---
tests/test_dunders.py | 3 +--
tests/test_funcs.py | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/tests/test_dunders.py b/tests/test_dunders.py
index 2f1ebab..6afe860 100644
--- a/tests/test_dunders.py
+++ b/tests/test_dunders.py
@@ -622,9 +622,8 @@ class TestAddInit(object):
with pytest.raises(TypeError) as e:
C(a=1, b=2)
- assert (
+ assert e.value.args[0].endswith(
"__init__() got an unexpected keyword argument 'a'"
- == e.value.args[0]
)
@given(booleans(), booleans())
diff --git a/tests/test_funcs.py b/tests/test_funcs.py
index 20e2747..64e3eb7 100644
--- a/tests/test_funcs.py
+++ b/tests/test_funcs.py
@@ -545,7 +545,7 @@ class TestEvolve(object):
with pytest.raises(TypeError) as e:
evolve(C(), aaaa=2)
expected = "__init__() got an unexpected keyword argument 'aaaa'"
- assert (expected,) == e.value.args
+ assert e.value.args[0].endswith(expected)
def test_validator_failure(self):
"""
--
2.31.1

View File

@ -10,7 +10,7 @@
Name: python-attrs
Version: 20.3.0
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Python attributes without boilerplate
License: MIT
@ -18,6 +18,11 @@ URL: http://www.attrs.org/
BuildArch: noarch
Source0: https://github.com/hynek/%{modname}/archive/%{version}/%{modname}-%{version}.tar.gz
# Partial backport of
# https://github.com/python-attrs/attrs/commit/03d3fc7a71fe770e1f86b9c3ad8588586e5ea63b
# to make tests pass. What happens next should be in
# https://github.com/python-attrs/attrs/issues/803
Patch0: fix-tests-with-Python-3.10.patch
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
@ -44,6 +49,7 @@ object protocols.
%prep
%setup -q -n %{modname}-%{version}
%patch0 -p1
%build
%py3_build
@ -62,6 +68,9 @@ PYTHONPATH=%{buildroot}/%{python3_sitelib} py.test-3 -v
%{python3_sitelib}/*
%changelog
* Wed May 05 2021 Lumír Balhar <lbalhar@redhat.com> - 20.3.0-3
- Fix tests with Python 3.10
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 20.3.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild