From f44b16cf9efdf91e671075b2695f2dced912e4d2 Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Fri, 12 May 2023 14:13:59 +0200 Subject: [PATCH] Add patch to fix test failures with py3.12 --- python-qrcode.spec | 2 ++ qrcode_assert-has-calls.patch | 9 +++++++++ qrcode_test.patch | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 qrcode_assert-has-calls.patch diff --git a/python-qrcode.spec b/python-qrcode.spec index c6768fd..3328bf2 100644 --- a/python-qrcode.spec +++ b/python-qrcode.spec @@ -14,6 +14,8 @@ BuildRequires: python3-devel # Comment out failing test Patch0: qrcode_test.patch +# Fix failure with Python3.12 +Patch1: qrcode_assert-has-calls.patch %description This module uses the Python Imaging Library (PIL) to allow for the\ diff --git a/qrcode_assert-has-calls.patch b/qrcode_assert-has-calls.patch new file mode 100644 index 0000000..d8efa19 --- /dev/null +++ b/qrcode_assert-has-calls.patch @@ -0,0 +1,9 @@ +diff -rupN --no-dereference qrcode-7.4.2/qrcode/tests/test_release.py qrcode-7.4.2-new/qrcode/tests/test_release.py +--- qrcode-7.4.2/qrcode/tests/test_release.py 2023-02-05 23:11:38.000000000 +0100 ++++ qrcode-7.4.2-new/qrcode/tests/test_release.py 2023-05-12 13:59:22.069372313 +0200 +@@ -37,4 +37,4 @@ class UpdateManpageTests(unittest.TestCa + .replace("version", "3.11") + .replace("date", datetime.datetime.now().strftime("%-d %b %Y")) + ) +- mock_file().write.has_calls([mock.call(line) for line in expected]) ++ mock_file().write.assert_has_calls([mock.call(line) for line in expected if line]) diff --git a/qrcode_test.patch b/qrcode_test.patch index 509af54..0809b2b 100644 --- a/qrcode_test.patch +++ b/qrcode_test.patch @@ -1,6 +1,6 @@ -diff -rupN qrcode-7.4.2/qrcode/tests/test_script.py qrcode-7.4.2-new/qrcode/tests/test_script.py +diff -rupN --no-dereference qrcode-7.4.2/qrcode/tests/test_script.py qrcode-7.4.2-new/qrcode/tests/test_script.py --- qrcode-7.4.2/qrcode/tests/test_script.py 2023-02-05 23:11:38.000000000 +0100 -+++ qrcode-7.4.2-new/qrcode/tests/test_script.py 2023-05-01 15:38:02.789941797 +0200 ++++ qrcode-7.4.2-new/qrcode/tests/test_script.py 2023-05-12 13:59:22.053372149 +0200 @@ -59,9 +59,9 @@ class ScriptTest(unittest.TestCase): def test_optimize(self, mock_print_ascii): main("testtext --optimize 0".split())