From b3d53b083e43ad53319e8e5a4541ea2b1d23c1efaeb3c6d0205aa10c9b56554a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Fri, 3 May 2024 22:27:45 +0200 Subject: [PATCH] Sync from SUSE:SLFO:Main python-pytest-qt revision 36316788cf20e5a81475a374522de7a5 --- .gitattributes | 23 ++++ _multibuild | 6 + pytest-qt-4.2.0.tar.gz | 3 + python-pytest-qt.changes | 267 +++++++++++++++++++++++++++++++++++++++ python-pytest-qt.spec | 143 +++++++++++++++++++++ 5 files changed, 442 insertions(+) create mode 100644 .gitattributes create mode 100644 _multibuild create mode 100644 pytest-qt-4.2.0.tar.gz create mode 100644 python-pytest-qt.changes create mode 100644 python-pytest-qt.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..e971a25 --- /dev/null +++ b/_multibuild @@ -0,0 +1,6 @@ + + test-pyqt5 + test-pyqt6 + test-pyside2 + test-pyside6 + diff --git a/pytest-qt-4.2.0.tar.gz b/pytest-qt-4.2.0.tar.gz new file mode 100644 index 0000000..14a0b5e --- /dev/null +++ b/pytest-qt-4.2.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00a17b586dd530b6d7a9399923a40489ca4a9a309719011175f55dc6b5dc8f41 +size 120749 diff --git a/python-pytest-qt.changes b/python-pytest-qt.changes new file mode 100644 index 0000000..cabaac4 --- /dev/null +++ b/python-pytest-qt.changes @@ -0,0 +1,267 @@ +------------------------------------------------------------------- +Fri Jun 23 19:07:24 UTC 2023 - Ben Greiner + +- Remove xfail_strict from pytest config + * pyside2 and py311 XPASS a test, gh#pytest-dev/pytest-qt#419 + +------------------------------------------------------------------- +Sat Jun 10 09:43:01 UTC 2023 - ecsos + +- Add %{?sle15_python_module_pythons} + +------------------------------------------------------------------- +Sat May 20 08:32:01 UTC 2023 - Ben Greiner + +- Skip failing exception tests with pyside6 + * gh#pytest-dev/pytest-qt#488 +- Use PEP517 + +------------------------------------------------------------------- +Wed Nov 30 12:26:35 UTC 2022 - Daniel Garcia + +- Remove python_module macro definition +- Update to 4.2.0: + * Import the code sub-package from the correct location rather than the + deprecated py package, restoring compatibility with pytest 7.2.0, where py + was dropped. Thanks @The-Compiler for the PR. + * Use pytest.hookimpl to configure hooks, avoiding a deprecation warning in + pytest 7.2.0. Thanks @The-Compiler for the PR. + * Now pytest-qt will check if any of the Qt libraries is already imported by + the time the plugin loads, and use it if that is the case (#412). Thanks + @eyllanesc for the PR. + * Most custom pytest-qt exceptions can be accessed via qtbot (for example + qtbot.TimeoutError), but it was not always explicit in the documentation + that this is the recommended way to access those exceptions, instead of + importing them from pytestqt.exceptions. This is now clarified in the + documentation and examples, and an alias to ScreenshotError has been added + to qtbot so it can be accessed in the same way (#460). + +------------------------------------------------------------------- +Fri Jul 1 19:06:12 UTC 2022 - Ben Greiner + +- Update to version 4.1.0 + * pytest-qt now requires Python 3.7+. + * Improved PEP-8 aliases definition so they have a smaller call + stack depth by one and better parameter suggestions in IDEs. + (#383). Thanks @luziferius for the PR. + * Updated model tester handling around hasChildren based on Qt's + updates. + * New qapp_cls fixture returning the QApplication class to use, + thus making it easier to use a custom subclass without having + to override the whole qapp fixture. Thanks @The-Compiler for + the PR. + * Updated model tester to track/verify in-flight changes based on + Qt's updates. Thanks @The-Compiler for the PR. + * New qtbot.screenshot() method which can be used to take a + screenshot of the given widget. Thanks @The-Compiler for the + PR. + +------------------------------------------------------------------- +Thu Apr 21 13:13:18 UTC 2022 - Ben Greiner + +- Enable pyside6 test flavor + +------------------------------------------------------------------- +Mon Jul 12 20:18:59 UTC 2021 - Ben Greiner + +- 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 + +- 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 `__ and `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 + +- require a default ttf font gh#pytest-dev/pytest-qt#317 +- move to %pytest macro and use pytest-xvfb plugin +- drop skip-timeout-tests.patch; deselect by pytest -k parameter + +------------------------------------------------------------------- +Mon Jan 6 13:07:28 UTC 2020 - Tomáš Chvátal + +- Update to 3.3.0: + * Improve message in uncaught exceptions by mentioning the Qt event loop instead of Qt virtual methods (#255). + * pytest-qt now requires pytest version >= 3.0. + * qtbot.addWiget now supports an optional before_close_func keyword-only argument, which if given is a function which is called before the widget is closed, with the widget as first argument. + +------------------------------------------------------------------- +Thu Jan 31 09:05:27 UTC 2019 - Tomáš Chvátal + +- Update to 3.2.2: + * Fix Off-by-one error in modeltester (#249). Thanks @ext-jmmugnes for the PR. + +------------------------------------------------------------------- +Fri Dec 7 19:04:18 UTC 2018 - Todd R + +- Update to version 3.2.1 + * Fixed compatibility with PyQt5 5.11.3 +- Update to version 3.2.0 + * The ``CallbackBlocker`` returned by ``qtbot.waitCallback()`` now has a new + ``assert_called_with(...)`` convenience method. +- Update to version 3.1.0 + * If Qt's model tester implemented in C++ is available (PyQt5 5.11 or newer), + the ``qtmodeltester`` fixture now uses that instead of the Python + implementation. This can be turned off by passing ``force_py=True`` to + ``qtmodeltester.check()``. + * The Python code used by ``qtmodeltester`` is now based on the latest Qt + modeltester. This also means that the ``data_display_may_return_none`` + attribute for ``qtmodeltester`` isn't used anymore. + * New ``qtbot.waitCallback()`` method that returns a ``CallbackBlocker``, which + can be used to wait for a callback to be called. + * ``qtbot.assertNotEmitted`` now has a new ``wait`` parameter which can be used + to make sure asynchronous signals aren't emitted by waiting after the code in + the ``with`` block finished. + * The ``qt_wait_signal_raising`` option was renamed to ``qt_default_raising``. + The old name continues to work, but is deprecated. + * The docs still referred to ``SignalTimeoutError`` in some places, despite it + being renamed to ``TimeoutError`` in the 2.1 release. This is now corrected. + * Improve debugging output when no Qt wrapper was found. + * When no context is available for warnings on Qt 5, no ``None:None:0`` line is + shown anymore. + * The ``no_qt_log`` marker is now registered with pytest so ``--strict`` can be + used. + * ``qtbot.waitSignal`` with timeout ``0`` now expects the signal to arrive + directly in the code enclosed by it. +- Update to version 3.0.2 + * Another fix related to ``QtInfoMsg`` objects during logging (`#225`_). +- Update to version 3.0.1 + * Fix handling of ``QtInfoMsg`` objects during logging (`#225`_). + Thanks `@willsALMANJ`_ for the report. +- Update to version 3.0.0 + * Removed ``qtbot.mouseEvent`` proxy, it was an internal Qt function which has + now been removed in PyQt 5.11 (`#219`_). Thanks `@mitya57`_ for the PR. + * Fix memory leak when tests raised an exception inside Qt virtual methods (`#187`_). + Thanks `@fabioz`_ for the report and PR. +- Rebase skip-timeout-tests.patch + +------------------------------------------------------------------- +Thu May 31 16:01:42 UTC 2018 - toddrme2178@gmail.com + +- Update to 2.3.2 + * Use new pytest 3.6 marker API when possible. + +------------------------------------------------------------------- +Sun May 13 08:24:32 UTC 2018 - tchvatal@suse.com + +- Enable tests +- Add patch skip-timeout-tests.patch to skip test randomly + failing in OBS + +------------------------------------------------------------------- +Sat May 12 16:24:16 UTC 2018 - arun@gmx.de + +- specfile: + * update copyright year + +- update to version 2.3.1: + * PYTEST_QT_API environment variable correctly wins over qt_api ini + variable if both are set at the same time (#196). Thanks @mochick + for the PR. + +- changes from version 2.3.0: + * New qapp_args fixture which can be used to pass custom arguments + to QApplication. Thanks @The-Compiler for the PR. + +- changes from version 2.2.1: + * modeltester now accepts QBrush for BackgroundColorRole and + TextColorRole (#189). Thanks @p0las for the PR. + +- changes from version 2.2.0: + * pytest-qt now supports PySide2 thanks to @rth! + +------------------------------------------------------------------- +Mon Aug 28 17:13:21 UTC 2017 - toddrme2178@gmail.com + +- Initial version diff --git a/python-pytest-qt.spec b/python-pytest-qt.spec new file mode 100644 index 0000000..35d9ec6 --- /dev/null +++ b/python-pytest-qt.spec @@ -0,0 +1,143 @@ +# +# spec file +# +# Copyright (c) 2023 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%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 +# invalid traceback gh#pytest-dev/pytest-qt#488 +%define testflavorargs --ignore tests/test_exceptions.py +%bcond_without test +BuildRequires: %{python_module pyside6} +BuildConflicts: %{python_module PyQt6} +BuildConflicts: %{python_module pyside2} +BuildConflicts: %{python_module qt5} +%endif + +%{?sle15_python_module_pythons} +Name: python-pytest-qt%{psuffix} +Version: 4.2.0 +Release: 0 +Summary: Pytest support for PyQt and PySide applications +License: MIT +Group: Development/Languages/Python +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 base >= 3.7} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module setuptools_scm} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: dos2unix +BuildRequires: fdupes +BuildRequires: python-rpm-macros >= 20210608 +# https://github.com/pytest-dev/pytest-qt/issues/317 +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} +BuildRequires: %{python_module pytest-qt = %{version}} +BuildRequires: %{python_module pytest} +%endif +%python_subpackages + +%description +Pytest-qt is a pytest plugin that allows programmers to write tests +for PySide and PyQt applications. + +The main usage is to use the `qtbot` fixture, responsible for handling `qApp` +creation as needed and provides methods to simulate user interaction, +like key presses and mouse clicks. + +%prep +%setup -q -n pytest-qt-%{version} +dos2unix LICENSE +# https://github.com/pytest-dev/pytest-qt/pull/419#discussion_r1240198866 +sed -i /xfail_strict/d setup.cfg + +%if ! %{with test} +%build +%pyproject_wheel +%endif + +%if ! %{with test} +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} +%endif + +%if %{with test} +%check +export QT_QPA_PLATFORM=offscreen +export PYTEST_QT_API=%{test_qtapi} +%pytest %{?testflavorargs} -rsxXfE +%endif + +%if ! %{with test} +%files %{python_files} +%license LICENSE +%doc CHANGELOG.rst README.rst +%{python_sitelib}/pytestqt +%{python_sitelib}/pytest_qt-%{version}.dist-info +%endif + +%changelog