Skip to content

Commit bbdbeb7

Browse files
committed
Skip image creation if PIL is not installed
1 parent e879798 commit bbdbeb7

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

qrcode.png

-697 Bytes
Binary file not shown.

qrcode/tests/test_module.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
import tempfile
44
from pathlib import Path
55

6+
import pytest
7+
8+
try:
9+
from PIL import Image, ImageDraw
10+
11+
PIL_NOT_INSTALLED = False
12+
except ImportError:
13+
PIL_NOT_INSTALLED = True
14+
615

716
def test_module_help():
817
"""Test that the module can be executed with the help flag."""
@@ -22,6 +31,7 @@ def test_module_help():
2231
assert "--factory" in result.stdout
2332

2433

34+
@pytest.mark.skipif(PIL_NOT_INSTALLED, reason="PIL is not installed")
2535
def test_module_generate_qrcode():
2636
"""Test that the module can generate a QR code image."""
2737
with tempfile.TemporaryDirectory() as temp_dir:

0 commit comments

Comments
 (0)