From e1059767d8309c8203d134f6ac0899f2f21ec7c3 Mon Sep 17 00:00:00 2001 From: Nulano Date: Thu, 30 Nov 2023 19:08:35 +0100 Subject: [PATCH] replace importlib.util.find_spec with try import except ImportError --- Tests/check_wheel.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Tests/check_wheel.py b/Tests/check_wheel.py index 38ec9c5d452..cc52cb75ebb 100644 --- a/Tests/check_wheel.py +++ b/Tests/check_wheel.py @@ -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