Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
goanpeca committed Jan 8, 2025
1 parent 5ed7bd4 commit 5aa71de
Showing 1 changed file with 36 additions and 34 deletions.
70 changes: 36 additions & 34 deletions napari_plugin_manager/_tests/test_qt_plugin_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,37 +610,39 @@ def test_shortcut_quit(plugin_dialog, qtbot):
assert not plugin_dialog.isVisible()


# def test_export_plugins(plugin_dialog, tmp_path, qtbot):
# def _timer():
# app = QApplication.instance()
# widgets = app.topLevelWidgets()
# for widget in widgets:
# qtbot.keyClick(widget, Qt.Key_Escape)

# timer = QTimer()
# timer.setSingleShot(True)
# timer.timeout.connect(_timer)
# timer.start(2000)
# plugin_dialog.export_button.click()

# plugin_dialog.export_plugins(str(tmp_path / 'plugins.txt'))
# assert (tmp_path / 'plugins.txt').exists()


# def test_import_plugins(plugin_dialog, tmp_path, qtbot):
# def _timer():
# app = QApplication.instance()
# widgets = app.topLevelWidgets()
# for widget in widgets:
# qtbot.keyClick(widget, Qt.Key_Escape)

# timer = QTimer()
# timer.setSingleShot(True)
# timer.timeout.connect(_timer)
# timer.start(2000)
# plugin_dialog.import_button.click()

# path = tmp_path / 'plugins.txt'
# path.write_text('requests\npyzenhub\n')
# with qtbot.waitSignal(plugin_dialog.installer.allFinished, timeout=60_000):
# plugin_dialog.import_plugins(str(path))
def test_export_plugins(plugin_dialog, tmp_path):
def _timer():
dialog = QApplication.activeModalWidget()
dialog.reject()

timer = QTimer()
timer.setSingleShot(True)
timer.timeout.connect(_timer)
timer.start(4000)
plugin_dialog.import_button.click()

timer = QTimer()
timer.setSingleShot(True)
timer.timeout.connect(_timer)
timer.start(4000)
plugin_dialog.export_button.click()

plugin_dialog.export_plugins(str(tmp_path / 'plugins.txt'))
assert (tmp_path / 'plugins.txt').exists()


def test_import_plugins(plugin_dialog, tmp_path, qtbot):
def _timer():
dialog = QApplication.activeModalWidget()
dialog.reject()

timer = QTimer()
timer.setSingleShot(True)
timer.timeout.connect(_timer)
timer.start(4000)
plugin_dialog.import_button.click()

path = tmp_path / 'plugins.txt'
path.write_text('requests\npyzenhub\n')
with qtbot.waitSignal(plugin_dialog.installer.allFinished, timeout=60_000):
plugin_dialog.import_plugins(str(path))

0 comments on commit 5aa71de

Please sign in to comment.