dev-python/pytest-qt: pytest plugin for Qt (PyQt4, PyQt5 and PySide)

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>
This commit is contained in:
Andrew Ammerlaan
2020-01-01 12:55:44 +01:00
committed by Joonas Niilola
parent 173a3c7160
commit f3b96f9055
4 changed files with 86 additions and 0 deletions

View File

@@ -0,0 +1 @@
DIST pytest-qt-3.3.0.tar.gz 113439 BLAKE2B 1eb486d2d44825058577306ed3b9ade34e6cbad0d90038fe314114bb22c82ae069c9fe66c170591de6c97bad99f5f9e0021c8b3dc38c858b8293a22c448bed74 SHA512 8b3ce7b62621c55fb319966b162cb60663c5ef290f34e62e6a9329e67f530c2bde1329ae0b045b15c99ae14f5f6a5fef9ee930475fa700922c50ee725adf7983

View File

@@ -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):
"""

View File

@@ -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>

View File

@@ -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
}