Fix test_page_attrs for Python 3.11

This commit is contained in:
Lumir Balhar 2022-05-03 12:21:07 +02:00
parent 04c2fa9e12
commit c95b868d99
2 changed files with 27 additions and 0 deletions

24
338.patch Normal file
View File

@ -0,0 +1,24 @@
From a533ad4f280f74a6704db7ddae93585e8a52a860 Mon Sep 17 00:00:00 2001
From: Lumir Balhar <lbalhar@redhat.com>
Date: Tue, 3 May 2022 12:08:50 +0200
Subject: [PATCH] Fix test_page_attrs for Python 3.11.
The error message is different in Python 3.11.
See: https://github.com/python/cpython/commit/0cb765b2cec9b020224af016a83bf35c45b71932
---
tests/test_page.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/test_page.py b/tests/test_page.py
index 0e9d42e0..5bad3007 100644
--- a/tests/test_page.py
+++ b/tests/test_page.py
@@ -259,7 +259,7 @@ def test_page_attrs(graph):
assert isinstance(graph.pages[0].Resources, Dictionary)
del graph.pages[0].Resources
- with pytest.raises(AttributeError, match="can't delete"):
+ with pytest.raises(AttributeError, match=r"can't delete|property of 'Page' object has no deleter"):
del graph.pages[0].obj
del graph.pages[0]['/Contents']

View File

@ -9,6 +9,9 @@ License: MPLv2.0
URL: https://github.com/pikepdf/pikepdf
Source0: %pypi_source
# Fixes one test's compatibility with Python 3.11
Patch0: https://github.com/pikepdf/pikepdf/pull/338.patch
BuildRequires: gcc-c++
BuildRequires: qpdf-devel >= 10.6.2
BuildRequires: python3-devel