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

Remove PySide2 from APIs on Python 3.11+ #400

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions qtpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ def __init__(self, *, missing_package=None, **superclass_kwargs):

API_NAMES = {'pyqt5': 'PyQt5', 'pyside2': 'PySide2',
'pyqt6': 'PyQt6', 'pyside6': 'PySide6'}
if sys.version_info >= (3, 11):
API_NAMES.pop('pyside2') # PySide2 does not support Python 3.11 and newer
API = os.environ.get(QT_API, 'pyqt5').lower()
initial_api = API
if API not in API_NAMES:
Expand Down
21 changes: 12 additions & 9 deletions qtpy/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,34 +44,37 @@ def test_cli_mypy_args():
)

if qtpy.PYQT5:
expected = ' '.join([
expected = [
'--always-true=PYQT5',
'--always-false=PYSIDE2',
'--always-false=PYQT6',
'--always-false=PYSIDE6',
])
]
elif qtpy.PYSIDE2:
expected = ' '.join([
expected = [
'--always-false=PYQT5',
'--always-true=PYSIDE2',
'--always-false=PYQT6',
'--always-false=PYSIDE6',
])
]
elif qtpy.PYQT6:
expected = ' '.join([
expected = [
'--always-false=PYQT5',
'--always-false=PYSIDE2',
'--always-true=PYQT6',
'--always-false=PYSIDE6',
])
]
elif qtpy.PYSIDE6:
expected = ' '.join([
expected = [
'--always-false=PYQT5',
'--always-false=PYSIDE2',
'--always-false=PYQT6',
'--always-true=PYSIDE6',
])
]
else:
assert False, 'No valid API to test'

assert output.stdout.strip() == expected.strip()
if sys.version_info >= (3, 11):
expected.pop(1) # no PySide2 there

assert output.stdout.strip() == ' '.join(expected).strip()