Skip to content

Commit

Permalink
replace importlib.util.find_spec with try import except ImportError
Browse files Browse the repository at this point in the history
  • Loading branch information
nulano committed Nov 30, 2023
1 parent 6fe42bd commit e105976
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Tests/check_wheel.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import importlib.util
import sys

from PIL import features
Expand All @@ -8,7 +7,11 @@ def test_wheel_modules():
expected_modules = {"pil", "tkinter", "freetype2", "littlecms2", "webp"}

# tkinter is not available in cibuildwheel installed CPython on Windows
if not importlib.util.find_spec("tkinter"):
try:
import tkinter

assert tkinter
except ImportError:
expected_modules.remove("tkinter")

assert set(features.get_supported_modules()) == expected_modules
Expand Down

0 comments on commit e105976

Please sign in to comment.