forked from pool/python-qrcode
Accepting request 1180322 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/1180322 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-qrcode?expand=0&rev=12
This commit is contained in:
33
364.patch
Normal file
33
364.patch
Normal file
@@ -0,0 +1,33 @@
|
||||
From 0fd5649d6f971e5c19ac7f6953e9d6737d3fbb0b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20Van=C4=9Bk?= <arkamar@atlas.cz>
|
||||
Date: Mon, 10 Jun 2024 13:22:24 +0200
|
||||
Subject: [PATCH] Add buffer and fileno for mocked sys.stdout
|
||||
|
||||
This change fixes the issue of two failing tests because the sys.stdout
|
||||
seems not to be properly mocked. Both tests need a buffer and test_piped
|
||||
additionally needs fileno method.
|
||||
---
|
||||
qrcode/tests/test_script.py | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/qrcode/tests/test_script.py b/qrcode/tests/test_script.py
|
||||
index 4ae4ccbc..96458e4c 100644
|
||||
--- a/qrcode/tests/test_script.py
|
||||
+++ b/qrcode/tests/test_script.py
|
||||
@@ -30,6 +30,8 @@ def test_isatty(self, mock_print_ascii):
|
||||
@mock.patch("sys.stdout")
|
||||
@unittest.skipIf(not Image, "Requires PIL")
|
||||
def test_piped(self, mock_stdout):
|
||||
+ mock_stdout.buffer = io.BytesIO()
|
||||
+ mock_stdout.fileno = lambda: 999
|
||||
main(["testtext"])
|
||||
|
||||
@mock.patch("os.isatty", lambda *args: True)
|
||||
@@ -61,6 +63,7 @@ def test_optimize(self, mock_print_ascii):
|
||||
|
||||
@mock.patch("sys.stdout")
|
||||
def test_factory(self, mock_stdout):
|
||||
+ mock_stdout.buffer = io.BytesIO()
|
||||
main("testtext --factory svg".split())
|
||||
|
||||
@mock.patch("sys.stderr")
|
@@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jun 12 12:06:29 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
|
||||
|
||||
- Cherry-pick upstream patch to fix build with GCC 14
|
||||
* https://github.com/lincolnloop/python-qrcode/pull/364.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Feb 5 07:00:36 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
|
@@ -24,6 +24,8 @@ Summary: QR Code image generator
|
||||
License: BSD-3-Clause
|
||||
URL: https://github.com/lincolnloop/python-qrcode
|
||||
Source: https://files.pythonhosted.org/packages/source/q/qrcode/qrcode-%{version}.tar.gz
|
||||
# PATCH-FIX-UPSTREAM - Add buffer and fileno for mocked sys.stdout
|
||||
Patch: https://github.com/lincolnloop/python-qrcode/pull/364.patch
|
||||
BuildRequires: %{python_module Pillow}
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module pypng}
|
||||
@@ -48,6 +50,7 @@ of QR Codes.
|
||||
|
||||
%prep
|
||||
%setup -q -n qrcode-%{version}
|
||||
%patch -P0 -p1
|
||||
# drop shebang from console_scripts
|
||||
sed -i '1s@^#!.*@@' qrcode/console_scripts.py
|
||||
|
||||
|
Reference in New Issue
Block a user