From b0160470719377da6484fad60a5735d287876dfa Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 11 Sep 2018 20:52:48 +0200 Subject: [PATCH 1/6] Use pytest.param Fixes this warning: tests/test_qtest_proxies.py:12: RemovedInPytest4Warning: Applying marks directly to parameters is deprecated, please use pytest.param(..., marks=...) instead. --- tests/test_qtest_proxies.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_qtest_proxies.py b/tests/test_qtest_proxies.py index e93e4917..58ee6ba7 100644 --- a/tests/test_qtest_proxies.py +++ b/tests/test_qtest_proxies.py @@ -18,7 +18,7 @@ "keyEvent", "keyPress", "keyRelease", - fails_on_pyqt("keyToAscii"), + pytest.param("keyToAscii", marks=fails_on_pyqt), "mouseClick", "mouseDClick", "mouseMove", From 59671e9a72ce9442f298889723d98cb36491f38b Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 11 Sep 2018 20:55:56 +0200 Subject: [PATCH 2/6] Use {posargs} in tox.ini --- setup.cfg | 3 +++ tox.ini | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 2a9acf13..a7da5076 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,5 @@ [bdist_wheel] universal = 1 + +[tool:pytest] +testpaths = tests diff --git a/tox.ini b/tox.ini index d945bba1..7383fe6e 100644 --- a/tox.ini +++ b/tox.ini @@ -7,7 +7,7 @@ deps= pyside2: pyside2 pyqt5: pyqt5 commands= - pytest tests + pytest {posargs} setenv= pyside2: PYTEST_QT_API=pyside2 pyqt5: PYTEST_QT_API=pyqt5 From c376db74ccc66c0184f69d8179f0298340e1579e Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 11 Sep 2018 20:57:42 +0200 Subject: [PATCH 3/6] Make pytest more strict --- setup.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.cfg b/setup.cfg index a7da5076..2f680978 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,3 +3,5 @@ universal = 1 [tool:pytest] testpaths = tests +addopts = --strict +xfail_strict = true From 2050be8abaeab84f1acd300465918464778c8a44 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 11 Sep 2018 20:59:02 +0200 Subject: [PATCH 4/6] Register no_qt_log marker properly --- pytestqt/plugin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pytestqt/plugin.py b/pytestqt/plugin.py index d47209f6..c09203b1 100644 --- a/pytestqt/plugin.py +++ b/pytestqt/plugin.py @@ -204,6 +204,9 @@ def pytest_configure(config): config.addinivalue_line( "markers", "qt_log_ignore: overrides qt_log_ignore ini option." ) + config.addinivalue_line( + "markers", "no_qt_log: Turn off Qt logging capture." + ) if config.getoption("qt_log"): config.pluginmanager.register(QtLoggingPlugin(config), "_qt_logging") From e2acebec93d83d84229d47ee531f5d2f1e479e84 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 11 Sep 2018 21:00:02 +0200 Subject: [PATCH 5/6] Update changelog --- CHANGELOG.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c241bbbd..363c3f9f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,9 @@ +3.0.3 (unreleased) +------------------ + +- Improve debugging output when no Qt wrapper was found. +- Register the ``no_qt_log`` marker with pytest so ``--strict`` can be used. + 3.0.2 (2018-08-31) ------------------ From 57bb3da1a526158702abecc250d214f699756eff Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 11 Sep 2018 22:21:02 +0200 Subject: [PATCH 6/6] Make black happy --- pytestqt/plugin.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pytestqt/plugin.py b/pytestqt/plugin.py index c09203b1..65fb0320 100644 --- a/pytestqt/plugin.py +++ b/pytestqt/plugin.py @@ -204,9 +204,7 @@ def pytest_configure(config): config.addinivalue_line( "markers", "qt_log_ignore: overrides qt_log_ignore ini option." ) - config.addinivalue_line( - "markers", "no_qt_log: Turn off Qt logging capture." - ) + config.addinivalue_line("markers", "no_qt_log: Turn off Qt logging capture.") if config.getoption("qt_log"): config.pluginmanager.register(QtLoggingPlugin(config), "_qt_logging")