Skip to content

Commit 58a64f1

Browse files
committed
Prefer PyQt5 if available as Qt4 is discontinued
1 parent 5333706 commit 58a64f1

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

CHANGELOG.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
1.12.dev
2-
--------
1+
2.0
2+
---
3+
4+
- ``pytest-qt`` now defaults to using ``PyQt5`` if ``PYTEST_QT_API`` is not set.
5+
Before, it preferred ``PySide`` which is using the discontinued Qt4.
36

47
- Exceptions caught by ``pytest-qt`` in ``sys.excepthook`` are now also printed
58
to ``stderr``, making debugging them easier from within an IDE.

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,16 @@ Features
7272
Requirements
7373
============
7474

75-
Works with either PySide_, PyQt_ (``PyQt4`` and ``PyQt5``) picking whichever
75+
Works with either PySide_ or PyQt_ (``PyQt5`` and ``PyQt4``) picking whichever
7676
is available on the system, giving preference to the first one installed in
7777
this order:
7878

79+
- ``PyQt5``
7980
- ``PySide``
8081
- ``PyQt4``
81-
- ``PyQt5``
8282

8383
To force a particular API, set the environment variable ``PYTEST_QT_API`` to
84-
``pyside``, ``pyqt4``, ``pyqt4v2`` or ``pyqt5``. ``pyqt4v2`` sets the ``PyQt4``
84+
``pyqt5``, ``pyside``, ``pyqt4``, or ``pyqt4v2``. ``pyqt4v2`` sets the ``PyQt4``
8585
API to `version 2 <http://pyqt.sourceforge.net/Docs/PyQt4/incompatible_apis.html>`_.
8686

8787

docs/intro.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ Python 2.7 or later, including Python 3+.
3030

3131
Requires pytest version 2.7 or later.
3232

33-
Works with either ``PySide``, ``PyQt4`` or ``PyQt5``, picking whichever
33+
Works with either ``PyQt5``, ``PySide`` or ``PyQt4``, picking whichever
3434
is available on the system giving preference to the first one installed in
3535
this order:
3636

37+
- ``PyQt5``
3738
- ``PySide``
3839
- ``PyQt4``
39-
- ``PyQt5``
4040

4141
To force a particular API, set the environment variable ``PYTEST_QT_API`` to
42-
``pyside``, ``pyqt4``, ``pyqt4v2`` or ``pyqt5``. ``pyqt4v2`` sets the ``PyQt4``
42+
``pyqt5``, ``pyside``, ``pyqt4`` or ``pyqt4v2``. ``pyqt4v2`` sets the ``PyQt4``
4343
API to `version 2 <version2>`_
4444

4545
.. _version2: http://pyqt.sourceforge.net/Docs/PyQt4/incompatible_apis.html

pytestqt/qt_compat.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ def _try_import(name):
2525
return False
2626

2727
def _guess_qt_api():
28-
if _try_import('PySide'):
28+
if _try_import('PyQt5'):
29+
return 'pyqt5'
30+
elif _try_import('PySide'):
2931
return 'pyside'
3032
elif _try_import('PyQt4'):
3133
return 'pyqt4'
32-
elif _try_import('PyQt5'):
33-
return 'pyqt5'
3434
else:
3535
msg = 'pytest-qt requires either PySide, PyQt4 or PyQt5 to be installed'
3636
raise RuntimeError(msg)

0 commit comments

Comments
 (0)