dev-python/pytest-qt: pytest plugin for Qt (PyQt4, PyQt5 and PySide)
authorAndrew Ammerlaan <andrewammerlaan@riseup.net>
Wed, 1 Jan 2020 11:55:44 +0000 (12:55 +0100)
committerJoonas Niilola <juippis@gentoo.org>
Thu, 23 Jan 2020 09:53:19 +0000 (11:53 +0200)
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@riseup.net>
Package-Manager: Portage-2.3.84, Repoman-2.3.20
Closes: https://github.com/gentoo/gentoo/pull/14007
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
dev-python/pytest-qt/Manifest [new file with mode: 0644]
dev-python/pytest-qt/files/pytest-qt-3.3.0-skip-show-window-test.patch [new file with mode: 0644]
dev-python/pytest-qt/metadata.xml [new file with mode: 0644]
dev-python/pytest-qt/pytest-qt-3.3.0.ebuild [new file with mode: 0644]

diff --git a/dev-python/pytest-qt/Manifest b/dev-python/pytest-qt/Manifest
new file mode 100644 (file)
index 0000000..15c6c86
--- /dev/null
@@ -0,0 +1 @@
+DIST pytest-qt-3.3.0.tar.gz 113439 BLAKE2B 1eb486d2d44825058577306ed3b9ade34e6cbad0d90038fe314114bb22c82ae069c9fe66c170591de6c97bad99f5f9e0021c8b3dc38c858b8293a22c448bed74 SHA512 8b3ce7b62621c55fb319966b162cb60663c5ef290f34e62e6a9329e67f530c2bde1329ae0b045b15c99ae14f5f6a5fef9ee930475fa700922c50ee725adf7983
diff --git a/dev-python/pytest-qt/files/pytest-qt-3.3.0-skip-show-window-test.patch b/dev-python/pytest-qt/files/pytest-qt-3.3.0-skip-show-window-test.patch
new file mode 100644 (file)
index 0000000..1acef2b
--- /dev/null
@@ -0,0 +1,36 @@
+diff --git a/tests/test_basics.py b/tests/test_basics.py
+index 7fdaf93..a972ea0 100644
+--- a/tests/test_basics.py
++++ b/tests/test_basics.py
+@@ -82,31 +82,6 @@ def test_stop_for_interaction(qtbot, timer):
+     qtbot.stopForInteraction()
+-@pytest.mark.parametrize("show", [True, False])
+-@pytest.mark.parametrize("method_name", ["waitExposed", "waitActive"])
+-def test_wait_window(show, method_name, qtbot):
+-    """
+-    Using one of the wait-widget methods should not raise anything if the widget
+-    is properly displayed, otherwise should raise a TimeoutError.
+-    """
+-    method = getattr(qtbot, method_name)
+-    if qt_api.pytest_qt_api != "pyqt5":
+-        with pytest.raises(RuntimeError) as exc_info:
+-            with method(None, None):
+-                pass
+-        assert str(exc_info.value) == "Available in PyQt5 only"
+-    else:
+-        widget = qt_api.QWidget()
+-        qtbot.add_widget(widget)
+-        if show:
+-            with method(widget, timeout=1000):
+-                widget.show()
+-        else:
+-            with pytest.raises(qtbot.TimeoutError):
+-                with method(widget, timeout=100):
+-                    pass
+-
+-
+ @pytest.mark.parametrize("method_name", ["waitExposed", "waitActive"])
+ def test_wait_window_propagates_other_exception(method_name, qtbot):
+     """
diff --git a/dev-python/pytest-qt/metadata.xml b/dev-python/pytest-qt/metadata.xml
new file mode 100644 (file)
index 0000000..d22e99d
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+       <maintainer type="person">
+               <email>andrewammerlaan@riseup.net</email>
+               <name>Andrew Ammerlaan</name>
+       </maintainer>
+       <maintainer type="project">
+               <email>proxy-maint@gentoo.org</email>
+               <name>Proxy Maintainers</name>
+       </maintainer>
+</pkgmetadata>
diff --git a/dev-python/pytest-qt/pytest-qt-3.3.0.ebuild b/dev-python/pytest-qt/pytest-qt-3.3.0.ebuild
new file mode 100644 (file)
index 0000000..4f2d4bd
--- /dev/null
@@ -0,0 +1,37 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7} )
+
+DISTUTILS_USE_SETUPTOOLS=rdepend
+
+inherit distutils-r1 virtualx
+
+DESCRIPTION="pytest plugin for PyQt4 or PyQt5 applications"
+HOMEPAGE="https://pypi.org/project/pytest-qt https://github.com/pytest-dev/pytest-qt"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+DEPEND="dev-python/QtPy[gui,testlib,${PYTHON_USEDEP}]"
+
+PATCHES=( "${FILESDIR}/${P}-skip-show-window-test.patch" )
+
+distutils_enable_tests pytest
+distutils_enable_sphinx docs dev-python/sphinx_rtd_theme
+
+python_test() {
+       pytest_qt_test() {
+               # pytest-qt test fail to test in ${BUILDIR}/lib
+               # if and only if pytest-qt is not already installed
+               # test do work if executed directly in the extracted tarball
+               local PYTHONPATH="${WORKDIR}/${P}"
+               pytest -vv
+       }
+
+       virtx pytest_qt_test
+}