napari-plugin-manager 0.1.6__py3-none-any.whl → 0.1.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- napari_plugin_manager/_tests/conftest.py +10 -10
- napari_plugin_manager/_tests/test_installer_process.py +123 -82
- napari_plugin_manager/_tests/test_npe2api.py +12 -11
- napari_plugin_manager/_tests/test_qt_plugin_dialog.py +91 -93
- napari_plugin_manager/_tests/test_utils.py +7 -7
- napari_plugin_manager/_version.py +16 -3
- napari_plugin_manager/base_qt_package_installer.py +144 -68
- napari_plugin_manager/base_qt_plugin_dialog.py +176 -157
- napari_plugin_manager/npe2api.py +3 -3
- napari_plugin_manager/qt_package_installer.py +44 -16
- napari_plugin_manager/qt_plugin_dialog.py +40 -30
- napari_plugin_manager/qt_warning_dialog.py +5 -3
- napari_plugin_manager/qt_widgets.py +3 -3
- napari_plugin_manager/styles.qss +30 -13
- napari_plugin_manager/utils.py +3 -3
- {napari_plugin_manager-0.1.6.dist-info → napari_plugin_manager-0.1.7.dist-info}/METADATA +9 -35
- napari_plugin_manager-0.1.7.dist-info/RECORD +23 -0
- {napari_plugin_manager-0.1.6.dist-info → napari_plugin_manager-0.1.7.dist-info}/WHEEL +1 -1
- napari_plugin_manager-0.1.6.dist-info/RECORD +0 -23
- {napari_plugin_manager-0.1.6.dist-info → napari_plugin_manager-0.1.7.dist-info}/licenses/LICENSE +0 -0
- {napari_plugin_manager-0.1.6.dist-info → napari_plugin_manager-0.1.7.dist-info}/top_level.txt +0 -0
|
@@ -19,8 +19,8 @@ from qtpy.QtWidgets import (
|
|
|
19
19
|
|
|
20
20
|
if qtpy.API_NAME == 'PySide2' and sys.version_info[:2] > (3, 10):
|
|
21
21
|
pytest.skip(
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
'Known PySide2 x Python incompatibility: '
|
|
23
|
+
'... object cannot be interpreted as an integer',
|
|
24
24
|
allow_module_level=True,
|
|
25
25
|
)
|
|
26
26
|
|
|
@@ -46,31 +46,33 @@ def _iter_napari_pypi_plugin_info(
|
|
|
46
46
|
list (the bottom one).
|
|
47
47
|
"""
|
|
48
48
|
# This mock `base_data`` will be the same for both fake plugins.
|
|
49
|
-
packages = ['
|
|
49
|
+
packages = ['packaging', 'requests', 'my-plugin', 'my-test-old-plugin-1']
|
|
50
50
|
base_data = {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
'metadata_version': '1.0',
|
|
52
|
+
'version': '0.1.0',
|
|
53
|
+
'summary': 'some test package',
|
|
54
|
+
'home_page': 'http://napari.org',
|
|
55
|
+
'author': 'test author',
|
|
56
|
+
'license': 'UNKNOWN',
|
|
57
57
|
}
|
|
58
58
|
for i in range(len(packages)):
|
|
59
|
-
yield
|
|
60
|
-
i
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
yield (
|
|
60
|
+
npe2.PackageMetadata(name=f'{packages[i]}', **base_data),
|
|
61
|
+
bool(i),
|
|
62
|
+
{
|
|
63
|
+
'home_page': 'www.mywebsite.com',
|
|
64
|
+
'pypi_versions': ['2.31.0'],
|
|
65
|
+
'conda_versions': ['2.32.1'],
|
|
66
|
+
'display_name': packages[i].upper(),
|
|
67
|
+
},
|
|
68
|
+
)
|
|
67
69
|
|
|
68
70
|
|
|
69
71
|
class PluginsMock:
|
|
70
72
|
def __init__(self):
|
|
71
73
|
self.plugins = {
|
|
72
74
|
'requests': True,
|
|
73
|
-
'
|
|
75
|
+
'packaging': True,
|
|
74
76
|
'my-plugin': True,
|
|
75
77
|
}
|
|
76
78
|
|
|
@@ -93,7 +95,7 @@ def plugins(qtbot):
|
|
|
93
95
|
return PluginsMock()
|
|
94
96
|
|
|
95
97
|
|
|
96
|
-
@pytest.fixture(params=[True, False], ids=[
|
|
98
|
+
@pytest.fixture(params=[True, False], ids=['constructor', 'no-constructor'])
|
|
97
99
|
def plugin_dialog(
|
|
98
100
|
request,
|
|
99
101
|
qtbot,
|
|
@@ -166,14 +168,18 @@ def plugin_dialog(
|
|
|
166
168
|
|
|
167
169
|
monkeypatch.setattr(
|
|
168
170
|
qt_plugin_dialog,
|
|
169
|
-
|
|
171
|
+
'iter_napari_plugin_info',
|
|
170
172
|
_iter_napari_pypi_plugin_info,
|
|
171
173
|
)
|
|
172
174
|
|
|
175
|
+
monkeypatch.setattr(
|
|
176
|
+
base_qt_plugin_dialog, 'RestartWarningDialog', MagicMock()
|
|
177
|
+
)
|
|
178
|
+
|
|
173
179
|
# This is patching `napari.utils.misc.running_as_constructor_app` function
|
|
174
180
|
# to mock a normal napari install.
|
|
175
181
|
monkeypatch.setattr(
|
|
176
|
-
qt_plugin_dialog,
|
|
182
|
+
qt_plugin_dialog, 'running_as_constructor_app', lambda: request.param
|
|
177
183
|
)
|
|
178
184
|
monkeypatch.setattr(
|
|
179
185
|
napari.plugins, 'plugin_manager', OldPluginManagerMock()
|
|
@@ -188,15 +194,18 @@ def plugin_dialog(
|
|
|
188
194
|
widget, '_is_main_app_conda_package', lambda: request.param
|
|
189
195
|
)
|
|
190
196
|
# monkeypatch.setattr(widget, '_tag_outdated_plugins', lambda: None)
|
|
191
|
-
|
|
192
|
-
|
|
197
|
+
with qtbot.waitExposed(widget):
|
|
198
|
+
widget.show()
|
|
193
199
|
|
|
200
|
+
assert widget.isVisible()
|
|
194
201
|
assert widget.available_list.count_visible() == 0
|
|
195
202
|
assert widget.available_list.count() == 0
|
|
196
203
|
qtbot.add_widget(widget)
|
|
197
204
|
yield widget
|
|
198
205
|
widget.hide()
|
|
199
206
|
widget._add_items_timer.stop()
|
|
207
|
+
if widget.worker is not None:
|
|
208
|
+
widget.worker.quit()
|
|
200
209
|
assert not widget._add_items_timer.isActive()
|
|
201
210
|
get_settings().plugins.use_npe2_adaptor = original_setting
|
|
202
211
|
|
|
@@ -206,11 +215,11 @@ def test_filter_not_available_plugins(request, plugin_dialog, qtbot):
|
|
|
206
215
|
Check that the plugins listed under available plugins are
|
|
207
216
|
enabled and disabled accordingly.
|
|
208
217
|
"""
|
|
209
|
-
if
|
|
218
|
+
if 'no-constructor' in request.node.name:
|
|
210
219
|
pytest.skip(
|
|
211
|
-
reason=
|
|
220
|
+
reason='This test is only relevant for constructor-based installs'
|
|
212
221
|
)
|
|
213
|
-
plugin_dialog.search(
|
|
222
|
+
plugin_dialog.search('e')
|
|
214
223
|
qtbot.wait(500)
|
|
215
224
|
item = plugin_dialog.available_list.item(0)
|
|
216
225
|
widget = plugin_dialog.available_list.itemWidget(item)
|
|
@@ -229,17 +238,17 @@ def test_filter_available_plugins(plugin_dialog, qtbot):
|
|
|
229
238
|
Test the dialog is correctly filtering plugins in the available plugins
|
|
230
239
|
list (the bottom one).
|
|
231
240
|
"""
|
|
232
|
-
plugin_dialog.search(
|
|
241
|
+
plugin_dialog.search('')
|
|
233
242
|
qtbot.wait(500)
|
|
234
243
|
assert plugin_dialog.available_list.count() == 0
|
|
235
244
|
assert plugin_dialog.available_list.count_visible() == 0
|
|
236
245
|
|
|
237
|
-
plugin_dialog.search(
|
|
246
|
+
plugin_dialog.search('no-match@123')
|
|
238
247
|
qtbot.wait(500)
|
|
239
248
|
assert plugin_dialog.available_list.count_visible() == 0
|
|
240
249
|
|
|
241
|
-
plugin_dialog.search(
|
|
242
|
-
plugin_dialog.search(
|
|
250
|
+
plugin_dialog.search('')
|
|
251
|
+
plugin_dialog.search('requests')
|
|
243
252
|
qtbot.wait(500)
|
|
244
253
|
assert plugin_dialog.available_list.count_visible() == 1
|
|
245
254
|
|
|
@@ -249,11 +258,11 @@ def test_filter_installed_plugins(plugin_dialog, qtbot):
|
|
|
249
258
|
Test the dialog is correctly filtering plugins in the installed plugins
|
|
250
259
|
list (the top one).
|
|
251
260
|
"""
|
|
252
|
-
plugin_dialog.search(
|
|
261
|
+
plugin_dialog.search('')
|
|
253
262
|
qtbot.wait(500)
|
|
254
263
|
assert plugin_dialog.installed_list.count_visible() == 2
|
|
255
264
|
|
|
256
|
-
plugin_dialog.search(
|
|
265
|
+
plugin_dialog.search('no-match@123')
|
|
257
266
|
qtbot.wait(500)
|
|
258
267
|
assert plugin_dialog.installed_list.count_visible() == 0
|
|
259
268
|
|
|
@@ -262,9 +271,9 @@ def test_visible_widgets(request, plugin_dialog):
|
|
|
262
271
|
"""
|
|
263
272
|
Test that the direct entry button and textbox are visible
|
|
264
273
|
"""
|
|
265
|
-
if
|
|
274
|
+
if 'constructor' in request.node.name:
|
|
266
275
|
pytest.skip(
|
|
267
|
-
reason=
|
|
276
|
+
reason='Tested functionality not available in constructor-based installs'
|
|
268
277
|
)
|
|
269
278
|
assert plugin_dialog.direct_entry_edit.isVisible()
|
|
270
279
|
assert plugin_dialog.direct_entry_btn.isVisible()
|
|
@@ -274,15 +283,15 @@ def test_version_dropdown(plugin_dialog, qtbot):
|
|
|
274
283
|
"""
|
|
275
284
|
Test that when the source drop down is changed, it displays the other versions properly.
|
|
276
285
|
"""
|
|
277
|
-
plugin_dialog.search(
|
|
286
|
+
plugin_dialog.search('requests')
|
|
278
287
|
qtbot.wait(500)
|
|
279
288
|
widget = plugin_dialog.available_list.item(0).widget
|
|
280
289
|
count = widget.version_choice_dropdown.count()
|
|
281
290
|
if count == 2:
|
|
282
|
-
assert widget.version_choice_dropdown.currentText() ==
|
|
291
|
+
assert widget.version_choice_dropdown.currentText() == '2.31.0'
|
|
283
292
|
# switch from PyPI source to conda one.
|
|
284
293
|
widget.source_choice_dropdown.setCurrentIndex(1)
|
|
285
|
-
assert widget.version_choice_dropdown.currentText() ==
|
|
294
|
+
assert widget.version_choice_dropdown.currentText() == '2.32.1'
|
|
286
295
|
|
|
287
296
|
|
|
288
297
|
def test_plugin_list_count_items(plugin_dialog):
|
|
@@ -291,22 +300,21 @@ def test_plugin_list_count_items(plugin_dialog):
|
|
|
291
300
|
|
|
292
301
|
def test_plugin_list_handle_action(plugin_dialog, qtbot):
|
|
293
302
|
item = plugin_dialog.installed_list.item(0)
|
|
294
|
-
with patch.object(qt_plugin_dialog.PluginListItem,
|
|
303
|
+
with patch.object(qt_plugin_dialog.PluginListItem, 'set_busy') as mock:
|
|
295
304
|
plugin_dialog.installed_list.handle_action(
|
|
296
305
|
item,
|
|
297
306
|
'my-test-old-plugin-1',
|
|
298
307
|
InstallerActions.UPGRADE,
|
|
299
308
|
)
|
|
300
309
|
mock.assert_called_with(
|
|
301
|
-
trans._(
|
|
310
|
+
trans._('updating...'), InstallerActions.UPGRADE
|
|
302
311
|
)
|
|
303
312
|
|
|
304
|
-
plugin_dialog.search(
|
|
313
|
+
plugin_dialog.search('requests')
|
|
305
314
|
qtbot.wait(500)
|
|
306
315
|
item = plugin_dialog.available_list.item(0)
|
|
307
316
|
if item is not None:
|
|
308
|
-
with patch.object(qt_plugin_dialog.PluginListItem,
|
|
309
|
-
|
|
317
|
+
with patch.object(qt_plugin_dialog.PluginListItem, 'set_busy') as mock:
|
|
310
318
|
plugin_dialog.available_list.handle_action(
|
|
311
319
|
item,
|
|
312
320
|
'my-test-old-plugin-1',
|
|
@@ -314,7 +322,7 @@ def test_plugin_list_handle_action(plugin_dialog, qtbot):
|
|
|
314
322
|
version='3',
|
|
315
323
|
)
|
|
316
324
|
mock.assert_called_once_with(
|
|
317
|
-
trans._(
|
|
325
|
+
trans._('installing...'), InstallerActions.INSTALL
|
|
318
326
|
)
|
|
319
327
|
|
|
320
328
|
plugin_dialog.available_list.handle_action(
|
|
@@ -325,32 +333,22 @@ def test_plugin_list_handle_action(plugin_dialog, qtbot):
|
|
|
325
333
|
)
|
|
326
334
|
assert mock.call_count >= 2
|
|
327
335
|
assert mock.call_args_list[1] == call(
|
|
328
|
-
|
|
336
|
+
'cancelling...', InstallerActions.CANCEL
|
|
329
337
|
)
|
|
330
338
|
|
|
331
339
|
qtbot.waitUntil(lambda: not plugin_dialog.worker.is_running)
|
|
332
340
|
|
|
333
341
|
|
|
334
|
-
def
|
|
335
|
-
dialog_mock = MagicMock()
|
|
336
|
-
monkeypatch.setattr(
|
|
337
|
-
base_qt_plugin_dialog, 'RestartWarningDialog', dialog_mock
|
|
338
|
-
)
|
|
339
|
-
plugin_dialog.exec_()
|
|
340
|
-
plugin_dialog.already_installed.add('brand-new-plugin')
|
|
341
|
-
plugin_dialog.hide()
|
|
342
|
-
dialog_mock.assert_called_once()
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
def test_plugin_uninstall_restart_warning(plugin_dialog, monkeypatch):
|
|
342
|
+
def test_plugin_restart_warning(plugin_dialog, monkeypatch):
|
|
346
343
|
dialog_mock = MagicMock()
|
|
347
344
|
monkeypatch.setattr(
|
|
348
345
|
base_qt_plugin_dialog, 'RestartWarningDialog', dialog_mock
|
|
349
346
|
)
|
|
350
347
|
plugin_dialog.exec_()
|
|
351
|
-
plugin_dialog.
|
|
348
|
+
plugin_dialog.modified_set.add('added-removed-updated-plugin')
|
|
352
349
|
plugin_dialog.hide()
|
|
353
350
|
dialog_mock.assert_called_once()
|
|
351
|
+
assert len(plugin_dialog.modified_set) == 0
|
|
354
352
|
|
|
355
353
|
|
|
356
354
|
def test_on_enabled_checkbox(plugin_dialog, qtbot, plugins, old_plugins):
|
|
@@ -386,20 +384,20 @@ def test_add_items_outdated_and_update(plugin_dialog, qtbot):
|
|
|
386
384
|
# In this case, my-plugin is installed with version 0.1.0, so the one we are trying to install
|
|
387
385
|
# is newer, so the update button should pop up.
|
|
388
386
|
new_plugin = (
|
|
389
|
-
npe2.PackageMetadata(name=
|
|
387
|
+
npe2.PackageMetadata(name='my-plugin', version='0.4.0'),
|
|
390
388
|
True,
|
|
391
389
|
{
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
390
|
+
'home_page': 'www.mywebsite.com',
|
|
391
|
+
'pypi_versions': ['0.4.0', '0.1.0'],
|
|
392
|
+
'conda_versions': ['0.4.0', '0.1.0'],
|
|
395
393
|
},
|
|
396
394
|
)
|
|
397
|
-
plugin_dialog._plugin_data_map[
|
|
395
|
+
plugin_dialog._plugin_data_map['my-plugin'] = new_plugin
|
|
398
396
|
plugin_dialog._plugin_queue = [new_plugin]
|
|
399
397
|
plugin_dialog._add_items()
|
|
400
398
|
item = plugin_dialog.installed_list.item(0)
|
|
401
399
|
widget = plugin_dialog.installed_list.itemWidget(item)
|
|
402
|
-
initial_version =
|
|
400
|
+
initial_version = '0.1.0'
|
|
403
401
|
mod_initial_version = initial_version.replace('.', '․') # noqa: RUF001
|
|
404
402
|
assert widget.update_btn.isVisible()
|
|
405
403
|
assert widget.version.text() == mod_initial_version
|
|
@@ -414,7 +412,7 @@ def test_add_items_outdated_and_update(plugin_dialog, qtbot):
|
|
|
414
412
|
'pkgs': ['my-plugin==0.4.0'],
|
|
415
413
|
}
|
|
416
414
|
)
|
|
417
|
-
updated_version =
|
|
415
|
+
updated_version = '0.4.0'
|
|
418
416
|
mod_updated_version = updated_version.replace('.', '․') # noqa: RUF001
|
|
419
417
|
assert not widget.update_btn.isVisible()
|
|
420
418
|
assert widget.version.text() == mod_updated_version
|
|
@@ -444,17 +442,17 @@ def test_exec(plugin_dialog):
|
|
|
444
442
|
|
|
445
443
|
|
|
446
444
|
def test_search_in_available(plugin_dialog):
|
|
447
|
-
idxs = plugin_dialog._search_in_available(
|
|
445
|
+
idxs = plugin_dialog._search_in_available('test')
|
|
448
446
|
if idxs:
|
|
449
447
|
assert idxs == [0, 1, 2, 3]
|
|
450
448
|
|
|
451
|
-
idxs = plugin_dialog._search_in_available(
|
|
449
|
+
idxs = plugin_dialog._search_in_available('*&%$')
|
|
452
450
|
assert idxs == []
|
|
453
451
|
|
|
454
452
|
|
|
455
453
|
def test_drop_event(plugin_dialog, tmp_path):
|
|
456
|
-
path_1 = tmp_path /
|
|
457
|
-
path_2 = tmp_path /
|
|
454
|
+
path_1 = tmp_path / 'example-1.txt'
|
|
455
|
+
path_2 = tmp_path / 'example-2.txt'
|
|
458
456
|
url_prefix = 'file:///' if os.name == 'nt' else 'file://'
|
|
459
457
|
data = QMimeData()
|
|
460
458
|
data.setUrls(
|
|
@@ -468,14 +466,14 @@ def test_drop_event(plugin_dialog, tmp_path):
|
|
|
468
466
|
|
|
469
467
|
|
|
470
468
|
@pytest.mark.skipif(
|
|
471
|
-
'napari_latest' in os.getenv('TOX_ENV_NAME')
|
|
472
|
-
and 'PySide2' in os.getenv('TOX_ENV_NAME'),
|
|
469
|
+
'napari_latest' in os.getenv('TOX_ENV_NAME', '')
|
|
470
|
+
and 'PySide2' in os.getenv('TOX_ENV_NAME', ''),
|
|
473
471
|
reason='PySide2 flaky with latest released napari',
|
|
474
472
|
)
|
|
475
473
|
def test_installs(qtbot, tmp_virtualenv, plugin_dialog, request):
|
|
476
|
-
if
|
|
474
|
+
if '[constructor]' in request.node.name:
|
|
477
475
|
pytest.skip(
|
|
478
|
-
reason=
|
|
476
|
+
reason='This test is only relevant for non-constructor-based installs'
|
|
479
477
|
)
|
|
480
478
|
|
|
481
479
|
plugin_dialog.set_prefix(str(tmp_virtualenv))
|
|
@@ -490,31 +488,31 @@ def test_installs(qtbot, tmp_virtualenv, plugin_dialog, request):
|
|
|
490
488
|
|
|
491
489
|
process_finished_data = blocker.args[0]
|
|
492
490
|
assert process_finished_data['action'] == InstallerActions.INSTALL
|
|
493
|
-
assert process_finished_data['pkgs'][0].startswith(
|
|
491
|
+
assert process_finished_data['pkgs'][0].startswith('requests')
|
|
494
492
|
qtbot.wait(5000)
|
|
495
493
|
|
|
496
494
|
|
|
497
495
|
@pytest.mark.parametrize(
|
|
498
|
-
|
|
496
|
+
'message_return',
|
|
499
497
|
[QMessageBox.StandardButton.Cancel, QMessageBox.StandardButton.Ok],
|
|
500
498
|
)
|
|
501
499
|
def test_install_pypi_constructor(
|
|
502
500
|
qtbot, tmp_virtualenv, plugin_dialog, request, message_return, monkeypatch
|
|
503
501
|
):
|
|
504
|
-
if
|
|
502
|
+
if 'no-constructor' in request.node.name:
|
|
505
503
|
pytest.skip(
|
|
506
|
-
reason=
|
|
504
|
+
reason='This test is to test pip in constructor-based installs'
|
|
507
505
|
)
|
|
508
506
|
# ensure pip is the installer tool, so that the warning will trigger
|
|
509
507
|
monkeypatch.setattr(
|
|
510
508
|
qt_plugin_dialog.PluginListItem,
|
|
511
509
|
'get_installer_tool',
|
|
512
|
-
lambda self: InstallerTools.
|
|
510
|
+
lambda self: InstallerTools.PYPI,
|
|
513
511
|
)
|
|
514
512
|
monkeypatch.setattr(
|
|
515
513
|
qt_plugin_dialog.PluginListItem,
|
|
516
514
|
'get_installer_source',
|
|
517
|
-
lambda self:
|
|
515
|
+
lambda self: 'PyPI',
|
|
518
516
|
)
|
|
519
517
|
|
|
520
518
|
plugin_dialog.set_prefix(str(tmp_virtualenv))
|
|
@@ -522,7 +520,7 @@ def test_install_pypi_constructor(
|
|
|
522
520
|
qtbot.wait(500)
|
|
523
521
|
item = plugin_dialog.available_list.item(0)
|
|
524
522
|
widget = plugin_dialog.available_list.itemWidget(item)
|
|
525
|
-
with patch.object(qt_plugin_dialog.QMessageBox,
|
|
523
|
+
with patch.object(qt_plugin_dialog.QMessageBox, 'exec_') as mock:
|
|
526
524
|
mock.return_value = message_return
|
|
527
525
|
if message_return == QMessageBox.StandardButton.Ok:
|
|
528
526
|
with qtbot.waitSignal(
|
|
@@ -536,9 +534,9 @@ def test_install_pypi_constructor(
|
|
|
536
534
|
|
|
537
535
|
|
|
538
536
|
def test_cancel(qtbot, tmp_virtualenv, plugin_dialog, request):
|
|
539
|
-
if
|
|
537
|
+
if '[constructor]' in request.node.name:
|
|
540
538
|
pytest.skip(
|
|
541
|
-
reason=
|
|
539
|
+
reason='This test is only relevant for non-constructor-based installs'
|
|
542
540
|
)
|
|
543
541
|
|
|
544
542
|
plugin_dialog.set_prefix(str(tmp_virtualenv))
|
|
@@ -554,22 +552,22 @@ def test_cancel(qtbot, tmp_virtualenv, plugin_dialog, request):
|
|
|
554
552
|
|
|
555
553
|
process_finished_data = blocker.args[0]
|
|
556
554
|
assert process_finished_data['action'] == InstallerActions.CANCEL
|
|
557
|
-
assert process_finished_data['pkgs'][0].startswith(
|
|
555
|
+
assert process_finished_data['pkgs'][0].startswith('requests')
|
|
558
556
|
assert plugin_dialog.available_list.count() == 1
|
|
559
557
|
assert plugin_dialog.installed_list.count() == 2
|
|
560
558
|
|
|
561
559
|
|
|
562
560
|
def test_cancel_all(qtbot, tmp_virtualenv, plugin_dialog, request):
|
|
563
|
-
if
|
|
561
|
+
if '[constructor]' in request.node.name:
|
|
564
562
|
pytest.skip(
|
|
565
|
-
reason=
|
|
563
|
+
reason='This test is only relevant for non-constructor-based installs'
|
|
566
564
|
)
|
|
567
565
|
|
|
568
566
|
plugin_dialog.set_prefix(str(tmp_virtualenv))
|
|
569
567
|
plugin_dialog.search('requests')
|
|
570
568
|
qtbot.wait(500)
|
|
571
569
|
item_1 = plugin_dialog.available_list.item(0)
|
|
572
|
-
plugin_dialog.search('
|
|
570
|
+
plugin_dialog.search('packaging')
|
|
573
571
|
qtbot.wait(500)
|
|
574
572
|
item_2 = plugin_dialog.available_list.item(0)
|
|
575
573
|
widget_1 = plugin_dialog.available_list.itemWidget(item_1)
|
|
@@ -587,9 +585,9 @@ def test_cancel_all(qtbot, tmp_virtualenv, plugin_dialog, request):
|
|
|
587
585
|
|
|
588
586
|
|
|
589
587
|
def test_direct_entry_installs(qtbot, tmp_virtualenv, plugin_dialog, request):
|
|
590
|
-
if
|
|
588
|
+
if '[constructor]' in request.node.name:
|
|
591
589
|
pytest.skip(
|
|
592
|
-
reason=
|
|
590
|
+
reason='The tested functionality is not available in constructor-based installs'
|
|
593
591
|
)
|
|
594
592
|
|
|
595
593
|
plugin_dialog.set_prefix(str(tmp_virtualenv))
|
|
@@ -601,12 +599,12 @@ def test_direct_entry_installs(qtbot, tmp_virtualenv, plugin_dialog, request):
|
|
|
601
599
|
|
|
602
600
|
process_finished_data = blocker.args[0]
|
|
603
601
|
assert process_finished_data['action'] == InstallerActions.INSTALL
|
|
604
|
-
assert process_finished_data['pkgs'][0].startswith(
|
|
602
|
+
assert process_finished_data['pkgs'][0].startswith('requests')
|
|
605
603
|
qtbot.wait(5000)
|
|
606
604
|
|
|
607
605
|
|
|
608
606
|
@pytest.mark.skipif(
|
|
609
|
-
sys.platform.startswith('linux'), reason=
|
|
607
|
+
sys.platform.startswith('linux'), reason='Test fails on linux randomly'
|
|
610
608
|
)
|
|
611
609
|
def test_shortcut_close(plugin_dialog, qtbot):
|
|
612
610
|
qtbot.keyClicks(
|
|
@@ -617,7 +615,7 @@ def test_shortcut_close(plugin_dialog, qtbot):
|
|
|
617
615
|
|
|
618
616
|
|
|
619
617
|
@pytest.mark.skipif(
|
|
620
|
-
sys.platform.startswith('linux'), reason=
|
|
618
|
+
sys.platform.startswith('linux'), reason='Test fails on linux randomly'
|
|
621
619
|
)
|
|
622
620
|
def test_shortcut_quit(plugin_dialog, qtbot):
|
|
623
621
|
qtbot.keyClicks(
|
|
@@ -628,7 +626,7 @@ def test_shortcut_quit(plugin_dialog, qtbot):
|
|
|
628
626
|
|
|
629
627
|
|
|
630
628
|
@pytest.mark.skipif(
|
|
631
|
-
not sys.platform.startswith('linux'), reason=
|
|
629
|
+
not sys.platform.startswith('linux'), reason='Test works only on linux'
|
|
632
630
|
)
|
|
633
631
|
def test_export_plugins_button(plugin_dialog):
|
|
634
632
|
def _timer():
|
|
@@ -649,7 +647,7 @@ def test_export_plugins(plugin_dialog, tmp_path):
|
|
|
649
647
|
|
|
650
648
|
|
|
651
649
|
@pytest.mark.skipif(
|
|
652
|
-
not sys.platform.startswith('linux'), reason=
|
|
650
|
+
not sys.platform.startswith('linux'), reason='Test works only on linux'
|
|
653
651
|
)
|
|
654
652
|
def test_import_plugins_button(plugin_dialog):
|
|
655
653
|
def _timer():
|
|
@@ -665,6 +663,6 @@ def test_import_plugins_button(plugin_dialog):
|
|
|
665
663
|
|
|
666
664
|
def test_import_plugins(plugin_dialog, tmp_path, qtbot):
|
|
667
665
|
path = tmp_path / 'plugins.txt'
|
|
668
|
-
path.write_text('requests\
|
|
666
|
+
path.write_text('requests\npackaging\n')
|
|
669
667
|
with qtbot.waitSignal(plugin_dialog.installer.allFinished, timeout=60_000):
|
|
670
668
|
plugin_dialog.import_plugins(str(path))
|
|
@@ -7,14 +7,14 @@ from napari_plugin_manager.utils import get_homepage_url, is_conda_package
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
@pytest.mark.parametrize(
|
|
10
|
-
|
|
10
|
+
('pkg_name', 'expected'),
|
|
11
11
|
[
|
|
12
|
-
(
|
|
13
|
-
(
|
|
14
|
-
(
|
|
15
|
-
(
|
|
16
|
-
(
|
|
17
|
-
(
|
|
12
|
+
('some-package', True),
|
|
13
|
+
('some-other-package', False),
|
|
14
|
+
('some-package-other', False),
|
|
15
|
+
('other-some-package', False),
|
|
16
|
+
('package', False),
|
|
17
|
+
('some', False),
|
|
18
18
|
],
|
|
19
19
|
)
|
|
20
20
|
def test_is_conda_package(pkg_name, expected, tmp_path):
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
# file generated by setuptools-scm
|
|
2
2
|
# don't change, don't track in version control
|
|
3
3
|
|
|
4
|
-
__all__ = [
|
|
4
|
+
__all__ = [
|
|
5
|
+
"__version__",
|
|
6
|
+
"__version_tuple__",
|
|
7
|
+
"version",
|
|
8
|
+
"version_tuple",
|
|
9
|
+
"__commit_id__",
|
|
10
|
+
"commit_id",
|
|
11
|
+
]
|
|
5
12
|
|
|
6
13
|
TYPE_CHECKING = False
|
|
7
14
|
if TYPE_CHECKING:
|
|
@@ -9,13 +16,19 @@ if TYPE_CHECKING:
|
|
|
9
16
|
from typing import Union
|
|
10
17
|
|
|
11
18
|
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
19
|
+
COMMIT_ID = Union[str, None]
|
|
12
20
|
else:
|
|
13
21
|
VERSION_TUPLE = object
|
|
22
|
+
COMMIT_ID = object
|
|
14
23
|
|
|
15
24
|
version: str
|
|
16
25
|
__version__: str
|
|
17
26
|
__version_tuple__: VERSION_TUPLE
|
|
18
27
|
version_tuple: VERSION_TUPLE
|
|
28
|
+
commit_id: COMMIT_ID
|
|
29
|
+
__commit_id__: COMMIT_ID
|
|
19
30
|
|
|
20
|
-
__version__ = version = '0.1.
|
|
21
|
-
__version_tuple__ = version_tuple = (0, 1,
|
|
31
|
+
__version__ = version = '0.1.7'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 1, 7)
|
|
33
|
+
|
|
34
|
+
__commit_id__ = commit_id = None
|