We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7fb34d6 commit b75b160Copy full SHA for b75b160
1 file changed
qrcode/tests/test_module.py
@@ -1,16 +1,13 @@
1
import subprocess
2
import sys
3
import tempfile
4
+from importlib.util import find_spec
5
from pathlib import Path
6
7
import pytest
8
-try:
9
- from PIL import Image, ImageDraw # noqa: F401
10
11
- PIL_NOT_INSTALLED = False
12
-except ImportError:
13
- PIL_NOT_INSTALLED = True
+PIL_NOT_AVAILABLE = find_spec("PIL") is None
14
15
16
def test_module_help():
@@ -31,7 +28,7 @@ def test_module_help():
31
28
assert "--factory" in result.stdout
32
29
33
30
34
-@pytest.mark.skipif(PIL_NOT_INSTALLED, reason="PIL is not installed")
+@pytest.mark.skipif(PIL_NOT_AVAILABLE, reason="PIL is not installed")
35
def test_module_generate_qrcode():
36
"""Test that the module can generate a QR code image."""
37
with tempfile.TemporaryDirectory() as temp_dir:
0 commit comments