Fix test_history cleanup failure.

The test may be skipped if the PyQt5.QtWebKitWidget import fails, but the
cleanup was still running and trying to delete a nonexistant web-history.
This commit is contained in:
Ryan Roden-Corrent 2017-03-22 19:55:03 -04:00
parent 93e0bfa410
commit 4296eed429

View File

@ -325,12 +325,12 @@ def test_history_interface(qtbot, webview, hist_interface):
@pytest.fixture
def cleanup_init():
yield
# prevent test_init from leaking state
hist = objreg.get('web-history')
hist.setParent(None)
objreg.delete('web-history')
yield
try:
hist = objreg.get('web-history')
hist.setParent(None)
objreg.delete('web-history')
from PyQt5.QtWebKit import QWebHistoryInterface
QWebHistoryInterface.setDefaultInterface(None)
except: