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.
This commit is contained in:
Florian Bruhin 2021-01-04 19:34:11 +01:00
parent 282b2b99e8
commit e6ae8797e7
1 changed files with 2 additions and 1 deletions

View File

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