summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-01-04 19:34:11 +0100
committerFlorian Bruhin <me@the-compiler.org>2021-01-04 19:45:22 +0100
commite6ae8797e71a678bef97a13b9057e29442e0ef48 (patch)
tree42dfa01291301716a0d5a44a8bc480c65158561f
parent282b2b99e858ab3dafa594e282912519bc9a9fe7 (diff)
downloadqutebrowser-e6ae8797e71a678bef97a13b9057e29442e0ef48.tar.gz
qutebrowser-e6ae8797e71a678bef97a13b9057e29442e0ef48.zip
tests: Make sure QWebEnginePage is deleted early
If we use the "webengineview" fixture and access QWebEngineProfile.defaultProfile(), it could happen that the profile outlives the page. In that case, we get a warning on pytest shutdown: Release of profile requested but WebEnginePage still not deleted. Expect troubles ! Thus, let's make sure the page is cleaned up earlier.
-rw-r--r--tests/helpers/fixtures.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/helpers/fixtures.py b/tests/helpers/fixtures.py
index 6f80099bb..b814a6ea7 100644
--- a/tests/helpers/fixtures.py
+++ b/tests/helpers/fixtures.py
@@ -444,7 +444,8 @@ def webengineview(qtbot, monkeypatch, web_tab_setup):
monkeypatch.setattr(objects, 'backend', usertypes.Backend.QtWebEngine)
view = QtWebEngineWidgets.QWebEngineView()
qtbot.add_widget(view)
- return view
+ yield view
+ view.setPage(None) # Avoid warning if using QWebEngineProfile
@pytest.fixture