File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 1+ from importlib .util import find_spec
2+
13# QR error correct levels
24ERROR_CORRECT_L = 1
35ERROR_CORRECT_M = 0
46ERROR_CORRECT_Q = 3
57ERROR_CORRECT_H = 2
8+
9+ # Constant whether the PIL library is installed.
10+ PIL_AVAILABLE = find_spec ("PIL" ) is not None
Original file line number Diff line number Diff line change 11import subprocess
22import sys
33import tempfile
4- from importlib .util import find_spec
54from pathlib import Path
65
76import pytest
87
9- PIL_NOT_AVAILABLE = find_spec ( "PIL" ) is None
8+ from qrcode . constants import PIL_AVAILABLE
109
1110
1211def test_module_help ():
@@ -27,7 +26,7 @@ def test_module_help():
2726 assert "--factory" in result .stdout
2827
2928
30- @pytest .mark .skipif (PIL_NOT_AVAILABLE , reason = "PIL is not installed" )
29+ @pytest .mark .skipif (not PIL_AVAILABLE , reason = "PIL is not installed" )
3130def test_module_generate_qrcode ():
3231 """Test that the module can generate a QR code image."""
3332 with tempfile .TemporaryDirectory () as temp_dir :
You can’t perform that action at this time.
0 commit comments