Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use importlib on Python > 3.11 in tests #396

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import io
import os
import sys
import imp
import shutil
import tempfile
import subprocess
Expand Down Expand Up @@ -306,12 +305,20 @@ def messageOutputHandler(msgType, logContext, msg):
def test_environment():
"""Tests require all bindings to be installed (except PySide on py3.5+)"""

if sys.version_info < (3, 5):
# PySide is not available for Python > 3.4
imp.find_module("PySide")
imp.find_module("PySide2")
imp.find_module("PyQt4")
imp.find_module("PyQt5")
# the imp module is removed with Python 3.12
if sys.version_info < (3, 11):
import imp
if sys.version_info < (3, 5):
# PySide is not available for Python > 3.4
imp.find_module("PySide")
imp.find_module("PySide2")
imp.find_module("PyQt4")
imp.find_module("PyQt5")
else:
from importlib.util import find_spec
find_spec("PySide2")
find_spec("PyQt4")
find_spec("PyQt5")


def test_load_ui_returntype():
Expand Down