Skip to content

Commit

Permalink
Run black
Browse files Browse the repository at this point in the history
  • Loading branch information
ptsavol committed Jul 30, 2024
1 parent 762c177 commit a33d942
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions tests/mock_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@

def create_toolboxui():
"""Returns ToolboxUI, where QSettings among others has been mocked."""
with (mock.patch("spinetoolbox.plugin_manager.PluginManager.load_installed_plugins"), 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):
with (
mock.patch("spinetoolbox.plugin_manager.PluginManager.load_installed_plugins"),
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_qsettings_value.side_effect = qsettings_value_side_effect
mock_set_app_style.return_value = True
toolbox = ToolboxUI()
Expand All @@ -42,16 +44,15 @@ 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.ToolboxUI.save_project"), 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.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.ToolboxUI.save_project"),
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.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 a33d942

Please sign in to comment.