Skip to content

Commit

Permalink
Update config page test to new API
Browse files Browse the repository at this point in the history
* 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).
  • Loading branch information
jitseniesen committed Nov 7, 2023
1 parent d5a9e4e commit cc01284
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
3 changes: 2 additions & 1 deletion spyder_unittest/widgets/confpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 1 addition & 9 deletions spyder_unittest/widgets/tests/test_confpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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()
Expand All @@ -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)
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit cc01284

Please sign in to comment.