1
0

Accepting request 905961 from home:bnavigator:branches:devel:languages:python:pytest

- Allow either of the valid Qt binding implementations, do not hard
  require python-qt5
- Enable multibuild for tests with different implementations
  * Pyside2, PyQt5, PyQt6
  * Prepared for Pyside6
- Update to version 4.0.2
  * Restored compatibility with PySide2 5.11, which doesn't depend on the
    ``shiboken2`` project, used by pytest-qt 4.0.0. The dependency is now not
    needed anymore, and the ``.isdeleted`` attribute of ``qt_compat`` (which
    isn't intended for public use) is removed.
- Release 4.0.1
  * The ``sip`` module now gets imported directly if ``PyQt5.sip`` /
    ``PyQt6.sip`` wasn't found, as it's still packaged like that in some
    distributions (`#369`_). Thanks `@The-Compiler`_ for the PR.
- Release 4.0.0
  * `PySide6 <https://pypi.org/project/PySide6>`__ and `PyQt6 <https://pypi.org/project/PyQt6>`__ (6.1+)
    are now supported. Thanks `@jensheilman`_ and `@The-Compiler`_ for the PRs (`#328`_, `#330`_).
  * ``pytest-qt`` now requires Python 3.6+.
  * When using PyQt5, ``pytest-qt`` now requires PyQt5 5.11 or newer (`#330`_).
  * Support for Qt4 (i.e. ``PyQt4`` and ``PySide``) is now dropped (`#279`_).
  * The ``qtbot.waitActive`` and ``qtbot.waitExposed`` context managers are now
    available with all Qt APIs, rather than only PyQt5 (`#361`_). Thanks
    `@The-Compiler`_ for the PR.
  * The ``qtbot.waitForWindowShown`` method is deprecated, as the underlying Qt
    method was obsoleted in Qt 5.0 and removed in Qt 6.0. Its name is imprecise and
    the pytest-qt wrapper does not raise TimeoutError if the window wasn't shown.
    Please use the ``qtbot.waitExposed`` context manager instead (`#361`_). Thanks
    `@The-Compiler`_ for the PR.
  * The old ``qtbot.stopForInteraction()`` name is now removed as it was
    cumbersome and rarely used. Use ``qtbot.stop()`` (added in 1.1.1) instead
    (`#306`_). Thanks `@The-Compiler`_ for the PR.
  * The old ``SignalTimeoutError`` exception alias is now removed, as it was renamed to
    ``TimeoutError`` in 2.1 (`#306`_). Thanks `@The-Compiler`_ for the PR.
  * The old ``qt_wait_signal_raising`` option is now removed, as it was renamed to
    ``qt_default_raising`` in 3.1 (`#306`_). Thanks `@The-Compiler`_ for the PR.
  * ``qtbot.waitSignal`` and ``waitSignals`` (as well as their PEP-8 aliases)
    supported passing ``None`` as signal, making them wait for the given timeout
    instead. This is not supported anymore, use ``qtbot.wait(ms)`` instead
    (`#306`_). Thanks `@The-Compiler`_ for the PR.
  * Various arguments to ``qtbot`` methods are now keyword-only (`#366`_):
    * ``qtbot.waitActive``: ``timeout`` (``widget`` being the only positional argument)
    * ``qtbot.waitExposed``: ``timeout`` (``widget`` being the only positional argument)
    * ``qtbot.waitSignal``:  ``timeout``, ``raising`` and ``check_params_cb`` (``signal`` being the only positional argument)
    * ``qtbot.waitSignals``:  ``timeout``, ``raising`` and ``check_params_cbs`` (``signals`` being the only positional argument)
    * ``qtbot.assertNotEmitted``:  ``wait`` (``signal`` being the only positional argument)
    * ``qtbot.waitUntil``:  ``timeout`` (``callback`` being the only positional argument)
    * ``qtbot.waitCallback``:  ``timeout`` and ``raising`` (with no positional arguments)
    The same applies to the respective PEP-8 aliases. Thanks `@The-Compiler`_ for
    the PR.
  * Various classes are now not importable from ``pytestqt.plugin`` anymore, and
    should instead be imported from the module they're residing in since the 1.6.0
    release (`#306`_):
    * ``pytestqt.plugin.QtBot`` -> ``pytestqt.qtbot.QtBot``
    * ``pytestqt.plugin.SignalBlocker`` -> ``pytestqt.wait_signal.SignalBlocker``
    * ``pytestqt.plugin.MultiSignalBlocker`` -> ``pytestqt.wait_signal.MultiSignalBlocker``
    * ``pytestqt.plugin.Record`` -> ``pytestqt.logging.Record``
    * ``pytestqt.plugin.capture_exceptions`` ->
      ``pytestqt.exceptions.capture_exceptions`` (but consider using
      ``qtbot.capture_exceptions`` instead)
    * ``pytestqt.plugin.format_captured_exceptions`` ->
      ``pytestqt.exceptions.format_captured_exceptions``
  * The ``qt_api.extract_from_variant`` and ``qt_api.make_variant`` functions
    (which were never intended for public usage) as well as all class aliases
    (such as ``qt_api.QWidget`` or ``qt_api.QEvent``, among others) are now
    removed. Thanks `@The-Compiler`_ for the PR.
  * The default timeouts for ``qtbot.waitSignal``, ``waitSignals``, ``waitUntil``
    and ``waitCallback``, ``waitActive`` and ``waitExposed`` have been raised from
    1s to 5s. This makes them in line the default timeout used by Qt's underlying
    methods such as ``QSignalSpy::wait``. To get the old behavior back, explicitly
    pass ``timeout=1000`` to those functions (`#306`_). Thanks `@The-Compiler`_
    for the PR.
  * ``waitUntil`` now raises a ``TimeoutError`` when a timeout occurs to make the
    cause of the timeout more explict (`#222`_). Thanks `@karlch`_ for the PR.
  * The ``QtTest::keySequence`` method is now exposed (if available, with Qt >=
    5.10) (`#289`_). Thanks `@The-Compiler`_ for the PR.
  * ``addWidget`` now enforces that its argument is a ``QWidget`` in order to
    display a clearer error when this isn't the case (`#290`_). Thanks
    `@The-Compiler`_ for the PR.
  * New option ``qt_qapp_name`` can be used to set the name of the
    ``QApplication`` created by ``pytest-qt``, defaulting to ``"pytest-qt-qapp"``
    (`#302`_). Thanks `@The-Compiler`_ for the PR.
  * When the ``-s`` (``--capture=no``) argument is passed to pytest, Qt log
    capturing is now disabled as well (`#300`_). Thanks `@The-Compiler`_ for the PR.
  * PEP-8 aliases (``add_widget``, ``wait_active``, etc) are no longer just simple
    assignments to the methods, but they are real methods which call the normal
    implementations. This makes subclasses work as expected, instead of having to
    duplicate the assignment (`#326`_, `#333`_). Thanks `@oliveira-mauricio`_ and
    `@jensheilman`_ for the PRs.
  * Errors related to the ``qt_compat`` module (such as an invalid
    ``PYTEST_QT_API`` setting or missing Qt API wrappers) are now shown as a more
    human-readable error message rather than an internal pytest error (`#355`_). Thanks
    `@The-Compiler`_ for the PR.

OBS-URL: https://build.opensuse.org/request/show/905961
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-qt?expand=0&rev=12
This commit is contained in:
Matej Cepl 2021-07-13 09:06:16 +00:00 committed by Git OBS Bridge
parent e705392566
commit 5dedac22c0
5 changed files with 190 additions and 20 deletions

6
_multibuild Normal file
View File

@ -0,0 +1,6 @@
<multibuild>
<flavor>test-pyqt5</flavor>
<flavor>test-pyqt6</flavor>
<flavor>test-pyside2</flavor>
<!-- flavor>test-pyside6</flavor -->
</multibuild>

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:714b0bf86c5313413f2d300ac613515db3a1aef595051ab8ba2ffe619dbe8925
size 113439

3
pytest-qt-4.0.2.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dfc5240dec7eb43b76bcb5f9a87eecae6ef83592af49f3af5f1d5d093acaa93e
size 113466

View File

@ -1,3 +1,103 @@
-------------------------------------------------------------------
Mon Jul 12 20:18:59 UTC 2021 - Ben Greiner <code@bnavigator.de>
- Allow either of the valid Qt binding implementations, do not hard
require python-qt5
- Enable multibuild for tests with different implementations
* Pyside2, PyQt5, PyQt6
* Prepared for Pyside6
-------------------------------------------------------------------
Mon Jun 14 15:02:19 UTC 2021 - Ben Greiner <code@bnavigator.de>
- Update to version 4.0.2
* Restored compatibility with PySide2 5.11, which doesn't depend on the
``shiboken2`` project, used by pytest-qt 4.0.0. The dependency is now not
needed anymore, and the ``.isdeleted`` attribute of ``qt_compat`` (which
isn't intended for public use) is removed.
- Release 4.0.1
* The ``sip`` module now gets imported directly if ``PyQt5.sip`` /
``PyQt6.sip`` wasn't found, as it's still packaged like that in some
distributions (`#369`_). Thanks `@The-Compiler`_ for the PR.
- Release 4.0.0
* `PySide6 <https://pypi.org/project/PySide6>`__ and `PyQt6 <https://pypi.org/project/PyQt6>`__ (6.1+)
are now supported. Thanks `@jensheilman`_ and `@The-Compiler`_ for the PRs (`#328`_, `#330`_).
* ``pytest-qt`` now requires Python 3.6+.
* When using PyQt5, ``pytest-qt`` now requires PyQt5 5.11 or newer (`#330`_).
* Support for Qt4 (i.e. ``PyQt4`` and ``PySide``) is now dropped (`#279`_).
* The ``qtbot.waitActive`` and ``qtbot.waitExposed`` context managers are now
available with all Qt APIs, rather than only PyQt5 (`#361`_). Thanks
`@The-Compiler`_ for the PR.
* The ``qtbot.waitForWindowShown`` method is deprecated, as the underlying Qt
method was obsoleted in Qt 5.0 and removed in Qt 6.0. Its name is imprecise and
the pytest-qt wrapper does not raise TimeoutError if the window wasn't shown.
Please use the ``qtbot.waitExposed`` context manager instead (`#361`_). Thanks
`@The-Compiler`_ for the PR.
* The old ``qtbot.stopForInteraction()`` name is now removed as it was
cumbersome and rarely used. Use ``qtbot.stop()`` (added in 1.1.1) instead
(`#306`_). Thanks `@The-Compiler`_ for the PR.
* The old ``SignalTimeoutError`` exception alias is now removed, as it was renamed to
``TimeoutError`` in 2.1 (`#306`_). Thanks `@The-Compiler`_ for the PR.
* The old ``qt_wait_signal_raising`` option is now removed, as it was renamed to
``qt_default_raising`` in 3.1 (`#306`_). Thanks `@The-Compiler`_ for the PR.
* ``qtbot.waitSignal`` and ``waitSignals`` (as well as their PEP-8 aliases)
supported passing ``None`` as signal, making them wait for the given timeout
instead. This is not supported anymore, use ``qtbot.wait(ms)`` instead
(`#306`_). Thanks `@The-Compiler`_ for the PR.
* Various arguments to ``qtbot`` methods are now keyword-only (`#366`_):
* ``qtbot.waitActive``: ``timeout`` (``widget`` being the only positional argument)
* ``qtbot.waitExposed``: ``timeout`` (``widget`` being the only positional argument)
* ``qtbot.waitSignal``: ``timeout``, ``raising`` and ``check_params_cb`` (``signal`` being the only positional argument)
* ``qtbot.waitSignals``: ``timeout``, ``raising`` and ``check_params_cbs`` (``signals`` being the only positional argument)
* ``qtbot.assertNotEmitted``: ``wait`` (``signal`` being the only positional argument)
* ``qtbot.waitUntil``: ``timeout`` (``callback`` being the only positional argument)
* ``qtbot.waitCallback``: ``timeout`` and ``raising`` (with no positional arguments)
The same applies to the respective PEP-8 aliases. Thanks `@The-Compiler`_ for
the PR.
* Various classes are now not importable from ``pytestqt.plugin`` anymore, and
should instead be imported from the module they're residing in since the 1.6.0
release (`#306`_):
* ``pytestqt.plugin.QtBot`` -> ``pytestqt.qtbot.QtBot``
* ``pytestqt.plugin.SignalBlocker`` -> ``pytestqt.wait_signal.SignalBlocker``
* ``pytestqt.plugin.MultiSignalBlocker`` -> ``pytestqt.wait_signal.MultiSignalBlocker``
* ``pytestqt.plugin.Record`` -> ``pytestqt.logging.Record``
* ``pytestqt.plugin.capture_exceptions`` ->
``pytestqt.exceptions.capture_exceptions`` (but consider using
``qtbot.capture_exceptions`` instead)
* ``pytestqt.plugin.format_captured_exceptions`` ->
``pytestqt.exceptions.format_captured_exceptions``
* The ``qt_api.extract_from_variant`` and ``qt_api.make_variant`` functions
(which were never intended for public usage) as well as all class aliases
(such as ``qt_api.QWidget`` or ``qt_api.QEvent``, among others) are now
removed. Thanks `@The-Compiler`_ for the PR.
* The default timeouts for ``qtbot.waitSignal``, ``waitSignals``, ``waitUntil``
and ``waitCallback``, ``waitActive`` and ``waitExposed`` have been raised from
1s to 5s. This makes them in line the default timeout used by Qt's underlying
methods such as ``QSignalSpy::wait``. To get the old behavior back, explicitly
pass ``timeout=1000`` to those functions (`#306`_). Thanks `@The-Compiler`_
for the PR.
* ``waitUntil`` now raises a ``TimeoutError`` when a timeout occurs to make the
cause of the timeout more explict (`#222`_). Thanks `@karlch`_ for the PR.
* The ``QtTest::keySequence`` method is now exposed (if available, with Qt >=
5.10) (`#289`_). Thanks `@The-Compiler`_ for the PR.
* ``addWidget`` now enforces that its argument is a ``QWidget`` in order to
display a clearer error when this isn't the case (`#290`_). Thanks
`@The-Compiler`_ for the PR.
* New option ``qt_qapp_name`` can be used to set the name of the
``QApplication`` created by ``pytest-qt``, defaulting to ``"pytest-qt-qapp"``
(`#302`_). Thanks `@The-Compiler`_ for the PR.
* When the ``-s`` (``--capture=no``) argument is passed to pytest, Qt log
capturing is now disabled as well (`#300`_). Thanks `@The-Compiler`_ for the PR.
* PEP-8 aliases (``add_widget``, ``wait_active``, etc) are no longer just simple
assignments to the methods, but they are real methods which call the normal
implementations. This makes subclasses work as expected, instead of having to
duplicate the assignment (`#326`_, `#333`_). Thanks `@oliveira-mauricio`_ and
`@jensheilman`_ for the PRs.
* Errors related to the ``qt_compat`` module (such as an invalid
``PYTEST_QT_API`` setting or missing Qt API wrappers) are now shown as a more
human-readable error message rather than an internal pytest error (`#355`_). Thanks
`@The-Compiler`_ for the PR.
-------------------------------------------------------------------
Fri Sep 25 09:19:58 UTC 2020 - Benjamin Greiner <code@bnavigator.de>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-pytest-qt
# spec file
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -16,28 +16,85 @@
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-pytest-qt
Version: 3.3.0
%{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == ""
%define psuffix %{nil}
%bcond_with test
%endif
%if "%{flavor}" == "test-pyqt5"
%define psuffix -%{flavor}
%define test_qtapi pyqt5
%bcond_without test
BuildRequires: %{python_module qt5}
BuildConflicts: %{python_module PyQt6}
BuildConflicts: %{python_module pyside2}
BuildConflicts: %{python_module pyside6}
%endif
%if "%{flavor}" == "test-pyqt6"
%define psuffix -%{flavor}
%define test_qtapi pyqt6
%bcond_without test
BuildRequires: %{python_module PyQt6}
BuildConflicts: %{python_module pyside2}
BuildConflicts: %{python_module pyside6}
BuildConflicts: %{python_module qt5}
%endif
%if "%{flavor}" == "test-pyside2"
%define psuffix -%{flavor}
# pyside is for the primary python3 flavor only
%define pythons python3
%define test_qtapi pyside2
%bcond_without test
BuildRequires: %{python_module pyside2}
BuildConflicts: %{python_module PyQt6}
BuildConflicts: %{python_module pyside6}
BuildConflicts: %{python_module qt5}
%endif
%if "%{flavor}" == "test-pyside6"
%define psuffix -%{flavor}
# pyside is for the primary python3 flavor only
%define pythons python3
%define test_qtapi pyside6
%bcond_without test
BuildRequires: %{python_module pyside6}
BuildConflicts: %{python_module PyQt6}
BuildConflicts: %{python_module pyside2}
BuildConflicts: %{python_module qt5}
%endif
Name: python-pytest-qt%{psuffix}
Version: 4.0.2
Release: 0
Summary: Pytest support for PyQt and PySide applications
License: MIT
Group: Development/Languages/Python
URL: http://github.com/pytest-dev/pytest-qt
URL: https://github.com/pytest-dev/pytest-qt
Source: https://files.pythonhosted.org/packages/source/p/pytest-qt/pytest-qt-%{version}.tar.gz
BuildRequires: %{python_module pytest >= 3.0}
BuildRequires: %{python_module pytest-xvfb}
BuildRequires: %{python_module qt5}
BuildRequires: %{python_module setuptools_scm}
BuildRequires: %{python_module setuptools}
BuildRequires: dos2unix
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-pytest >= 3.0
Requires: python-qt5
BuildRequires: python-rpm-macros >= 20210608
# https://github.com/pytest-dev/pytest-qt/issues/317
Requires: free-ttf-fonts
Requires: bitstream-vera-fonts
Requires: python-pytest >= 3.0
Suggests: python-PyQt6
Suggests: python-pyside2
Suggests: python-pyside6
Suggests: python-qt5
BuildArch: noarch
%if "%{python_flavor}" == "python3" || "%{python_provides}" == "python3"
Requires: (python-qt5 or python-PyQt6 or python3-pyside2 or python3-pyside6)
%else
Requires: (python-qt5 or python-PyQt6)
%endif
%if %{with test}
# https://github.com/pytest-dev/pytest-qt/issues/376
BuildRequires: %{python_module pytest >= 4.5}
BuildRequires: %{python_module pytest-qt = %{version}}
%endif
%python_subpackages
%description
@ -52,23 +109,30 @@ like key presses and mouse clicks.
%setup -q -n pytest-qt-%{version}
dos2unix LICENSE
%if ! %{with test}
%build
%python_build
%endif
%if ! %{with test}
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%endif
%if %{with test}
%check
export PYTEST_QT_API=pyqt5
# test_qt_api_ini_config* needs the qt4 and pyside/etc
# test_wait_window fails randomly on OBS
%pytest -k 'not (test_qt_api_ini_config or test_wait_window)'
export QT_QPA_PLATFORM=offscreen
export PYTEST_QT_API=%{test_qtapi}
%pytest
%endif
%if ! %{with test}
%files %{python_files}
%license LICENSE
%doc CHANGELOG.rst README.rst
%{python_sitelib}/pytestqt
%{python_sitelib}/pytest_qt-%{version}-py*.egg-info
%endif
%changelog