Skip to content

Commit

Permalink
Try again
Browse files Browse the repository at this point in the history
  • Loading branch information
ptsavol committed Jul 30, 2024
1 parent c9f3d0d commit 503d62d
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions tests/mock_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@

def create_toolboxui():
"""Returns ToolboxUI, where QSettings among others has been mocked."""
with (
mock.patch("spinetoolbox.ui_main.QSettings.value") as mock_qsettings_value,
mock.patch("spinetoolbox.ui_main.ToolboxUI.set_app_style") as mock_set_app_style,
mock.patch("spinetoolbox.plugin_manager.PluginManager.load_installed_plugins"),
with mock.patch(
"spinetoolbox.ui_main.QSettings.value") as mock_qsettings_value, mock.patch(
"spinetoolbox.ui_main.ToolboxUI.set_app_style") as mock_set_app_style, mock.patch(
"spinetoolbox.plugin_manager.PluginManager.load_installed_plugins"
):
mock_qsettings_value.side_effect = qsettings_value_side_effect
mock_set_app_style.return_value = True
Expand All @@ -44,15 +44,13 @@ def create_project(toolbox, project_dir):
def create_toolboxui_with_project(project_dir):
"""Returns ToolboxUI with a project instance where
QSettings among others has been mocked."""
with (
mock.patch("spinetoolbox.ui_main.QSettings.value") as mock_qsettings_value,
mock.patch("spinetoolbox.ui_main.ToolboxUI.set_app_style") as mock_set_app_style,
mock.patch("spinetoolbox.ui_main.ToolboxUI.save_project"),
mock.patch("spinetoolbox.ui_main.QSettings.setValue"),
mock.patch("spinetoolbox.ui_main.QSettings.sync"),
mock.patch("spinetoolbox.plugin_manager.PluginManager.load_installed_plugins"),
mock.patch("spinetoolbox.ui_main.QScrollArea.setWidget"),
):
with mock.patch("spinetoolbox.ui_main.QSettings.value") as mock_qsettings_value, mock.patch(
"spinetoolbox.ui_main.ToolboxUI.set_app_style") as mock_set_app_style, mock.patch(
"spinetoolbox.ui_main.ToolboxUI.save_project"), mock.patch(
"spinetoolbox.ui_main.QSettings.setValue"), mock.patch(
"spinetoolbox.ui_main.QSettings.sync"), mock.patch(
"spinetoolbox.plugin_manager.PluginManager.load_installed_plugins"), mock.patch(
"spinetoolbox.ui_main.QScrollArea.setWidget"):
mock_qsettings_value.side_effect = qsettings_value_side_effect
mock_set_app_style.return_value = True
toolbox = ToolboxUI()
Expand Down

0 comments on commit 503d62d

Please sign in to comment.