From 137946a71519e0cc4dfd65c0101b0c0b75050e78 Mon Sep 17 00:00:00 2001 From: Mariana Bedran Lesche Date: Thu, 26 Sep 2024 17:41:21 -0300 Subject: [PATCH] Fix import errors in tests --- qrcode/tests/test_qrcode_pypng.py | 5 ++++- qrcode/tests/test_script.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/qrcode/tests/test_qrcode_pypng.py b/qrcode/tests/test_qrcode_pypng.py index 0245b207..c502a3b3 100644 --- a/qrcode/tests/test_qrcode_pypng.py +++ b/qrcode/tests/test_qrcode_pypng.py @@ -1,13 +1,16 @@ import io from unittest import mock -import png +import pytest + import qrcode import qrcode.util from qrcode.image.pure import PyPNGImage from qrcode.tests.consts import UNICODE_TEXT +png = pytest.importorskip("png", reason="png is not installed") + def test_render_pypng(): qr = qrcode.QRCode() diff --git a/qrcode/tests/test_script.py b/qrcode/tests/test_script.py index fbb8b285..5135b1fb 100644 --- a/qrcode/tests/test_script.py +++ b/qrcode/tests/test_script.py @@ -48,6 +48,7 @@ def test_stdin_py3_unicodedecodeerror(): def test_optimize(): + pytest.importorskip("PyPNG", reason="Requires PyPNG") main("testtext --optimize 0".split())