Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
goanpeca committed Oct 16, 2024
1 parent 7271a82 commit 0d96d14
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions napari_plugin_manager/_tests/test_qt_plugin_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,22 +325,26 @@ def test_plugin_list_handle_action(plugin_dialog, qtbot):
plugin_dialog.search("requests")
qtbot.wait(500)
item = plugin_dialog.available_list.item(0)
with patch.object(qt_plugin_dialog.PluginListItem, "set_busy") as mock:

plugin_dialog.available_list.handle_action(
item,
'my-test-old-plugin-1',
InstallerActions.INSTALL,
version='3',
)
mock.assert_called_with(
trans._("installing..."), InstallerActions.INSTALL
)

plugin_dialog.available_list.handle_action(
item, 'my-test-old-plugin-1', InstallerActions.CANCEL, version='3'
)
mock.assert_called_with("", InstallerActions.CANCEL)
if item is not None:
with patch.object(qt_plugin_dialog.PluginListItem, "set_busy") as mock:

plugin_dialog.available_list.handle_action(
item,
'my-test-old-plugin-1',
InstallerActions.INSTALL,
version='3',
)
mock.assert_called_with(
trans._("installing..."), InstallerActions.INSTALL
)

plugin_dialog.available_list.handle_action(
item,
'my-test-old-plugin-1',
InstallerActions.CANCEL,
version='3',
)
mock.assert_called_with("", InstallerActions.CANCEL)

qtbot.waitUntil(lambda: not plugin_dialog.worker.is_running)

Expand Down

0 comments on commit 0d96d14

Please sign in to comment.