From cc0128416a73084b04b06a059dbd6314564d8173 Mon Sep 17 00:00:00 2001 From: Jitse Niesen Date: Tue, 7 Nov 2023 12:28:47 +0000 Subject: [PATCH] Update config page test to new API * Return value of `.create_checkbox()` changed in spyder-ide/spyder#20926 (Show tooltips in Preferences). * Handling of Prefs dialog box size changed in spyder-ide/spyder#21233 (Improve style of Preferences dialog box). --- spyder_unittest/widgets/confpage.py | 3 ++- spyder_unittest/widgets/tests/test_confpage.py | 10 +--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/spyder_unittest/widgets/confpage.py b/spyder_unittest/widgets/confpage.py index e924b14..b46473b 100644 --- a/spyder_unittest/widgets/confpage.py +++ b/spyder_unittest/widgets/confpage.py @@ -24,8 +24,9 @@ class UnitTestConfigPage(PluginConfigPage): def setup_page(self) -> None: settings_group = QGroupBox(_('Settings')) - self.abbrev_box = self.create_checkbox( + widget = self.create_checkbox( _('Abbreviate test names'), 'abbrev_test_names', default=False) + self.abbrev_box = widget.checkbox settings_layout = QVBoxLayout() settings_layout.addWidget(self.abbrev_box) diff --git a/spyder_unittest/widgets/tests/test_confpage.py b/spyder_unittest/widgets/tests/test_confpage.py index 5ea6bdc..6790a18 100644 --- a/spyder_unittest/widgets/tests/test_confpage.py +++ b/spyder_unittest/widgets/tests/test_confpage.py @@ -71,9 +71,6 @@ def get_plugin(self, plugin_name, error=True): if plugin_name in PLUGIN_REGISTRY: return PLUGIN_REGISTRY.get_plugin(plugin_name) - def set_prefs_size(self, size): - pass - class ConfigDialogTester(QWidget): def __init__(self, parent, main_class, @@ -83,9 +80,6 @@ def __init__(self, parent, main_class, if self._main is None: self._main = MainWindowMock(self) - def set_prefs_size(self, size): - pass - def register_plugin(self, plugin_name, external=False): plugin = PLUGIN_REGISTRY.get_plugin(plugin_name) plugin._register() @@ -101,8 +95,6 @@ def get_plugin(self, plugin_name, error=True): # types.MethodType(register_plugin, self._main)) setattr(self._main, 'get_plugin', types.MethodType(get_plugin, self._main)) - setattr(self._main, 'set_prefs_size', - types.MethodType(set_prefs_size, self._main)) PLUGIN_REGISTRY.reset() PLUGIN_REGISTRY.sig_plugin_ready.connect(self._main.register_plugin) @@ -135,7 +127,7 @@ def config_dialog(qtbot, request): qtbot.addWidget(main_ref) preferences = main_ref._main.get_plugin(Plugins.Preferences) - preferences.open_dialog(None) + preferences.open_dialog() container = preferences.get_container() dlg = container.dialog