Clean up Qt view used in completion tests.

Add the view created during the tests to qtot so it gets cleaned up
after the test exits.
This commit is contained in:
Ryan Roden-Corrent 2016-06-30 07:19:36 -04:00
parent ee59b133c0
commit 849706e310

View File

@ -238,7 +238,7 @@ def test_tab_completion(stubs, qtbot, app_stub, win_registry,
def test_tab_completion_delete(stubs, qtbot, app_stub, win_registry,
tabbed_browser_stubs):
tabbed_browser_stubs, qtbot):
"""Verify closing a tab by deleting it from the completion widget."""
tabbed_browser_stubs[0].tabs = [
stubs.FakeWebView(QUrl('https://github.com'), 'GitHub', 0),
@ -250,6 +250,7 @@ def test_tab_completion_delete(stubs, qtbot, app_stub, win_registry,
]
model = miscmodels.TabCompletionModel()
view = _mock_view_index(model, 0, 1)
qtbot.add_widget(view)
model.delete_cur_item(view)
actual = [tab.url() for tab in tabbed_browser_stubs[0].tabs]
assert actual == [QUrl('https://github.com'),