From 88cfc1c3edbfcadec35ba9653e2d9b7608bdb5a2 Mon Sep 17 00:00:00 2001 From: toofar Date: Mon, 29 Jan 2024 23:28:29 +1300 Subject: Fix tab widget benchmark tests In 8aa88b83e I added a dependency in the TabWidget in `parent.is_shutting_down` (assuming parent is a TabbedBrowser, but without updating the type hints...). Since the benchmark test wasn't setting a parent it's been breaking since then, oops. That's going to be breaking all the branches based off of the tree tabs branch, so we should probably cherry pick this back to the tree-tabs-integration branch. And consider updating the TabWidget parent kwarg type hint (and make the dummpy parent a mock/spy/double of the TabbedBrowser I guess). Not sure where the size of 640x480 came from before hand but when I added a parent it went to 100x30. --- tests/unit/mainwindow/test_tabwidget.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/unit/mainwindow/test_tabwidget.py b/tests/unit/mainwindow/test_tabwidget.py index a249a6d1c..59defeb50 100644 --- a/tests/unit/mainwindow/test_tabwidget.py +++ b/tests/unit/mainwindow/test_tabwidget.py @@ -11,6 +11,7 @@ import pytest from unittest.mock import Mock from qutebrowser.qt.gui import QIcon, QPixmap +from qutebrowser.qt.widgets import QWidget from qutebrowser.mainwindow import tabwidget from qutebrowser.utils import usertypes @@ -21,7 +22,14 @@ class TestTabWidget: @pytest.fixture def widget(self, qtbot, monkeypatch, config_stub): - w = tabwidget.TabWidget(0) + class DummyParent(QWidget): + def __init__(self): + super().__init__() + self.is_shutting_down = False + self.show() + + w = tabwidget.TabWidget(0, parent=DummyParent()) + w.resize(640, 480) qtbot.add_widget(w) monkeypatch.setattr(tabwidget.objects, 'backend', usertypes.Backend.QtWebKit) -- cgit v1.2.3-54-g00ecf