replace importlib.util.find_spec with try import except ImportError

This commit is contained in:
Nulano 2023-11-30 19:08:35 +01:00
parent 6fe42bddd9
commit e1059767d8

View File

@ -1,4 +1,3 @@
import importlib.util
import sys
from PIL import features
@ -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