From 203233c89434d35e72768b25464b670fc0f8a20a Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 20 Nov 2017 20:47:40 +0100 Subject: [PATCH] Track the view correctly in the webengineview fixture This makes sure the view is closed after the test (fixing test_none on AppVeyor) and also makes sure we have a QApplication. --- tests/helpers/fixtures.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/helpers/fixtures.py b/tests/helpers/fixtures.py index 6e17ebd71..45ec6ad09 100644 --- a/tests/helpers/fixtures.py +++ b/tests/helpers/fixtures.py @@ -315,10 +315,12 @@ def qnam(qapp): @pytest.fixture -def webengineview(): +def webengineview(qtbot): """Get a QWebEngineView if QtWebEngine is available.""" QtWebEngineWidgets = pytest.importorskip('PyQt5.QtWebEngineWidgets') - return QtWebEngineWidgets.QWebEngineView() + view = QtWebEngineWidgets.QWebEngineView() + qtbot.add_widget(view) + return view @pytest.fixture