Skip to content

Commit

Permalink
Add integration test with napari (#65)
Browse files Browse the repository at this point in the history
This adds some test to ensure the plugin can be programmatically added
as a widget to the napari viewer.
  • Loading branch information
andy-sweet authored May 21, 2023
1 parent efdcc89 commit e6da33d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,36 @@ on:
push:
branches:
- main
- npe2
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches:
- main
- npe2
workflow_dispatch:

jobs:
validate:
name: validate with npe2
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .
- name: Validate with npe2
run: npe2 validate napari-metadata

test:
needs: [validate]
name: ${{ matrix.platform }} py${{ matrix.python-version }}
runs-on: ${{ matrix.platform }}
strategy:
Expand Down
7 changes: 7 additions & 0 deletions src/napari_metadata/_tests/test_napari.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from napari_metadata._widget import MetadataWidget


def test_add_widget_to_napari(make_napari_viewer):
viewer = make_napari_viewer()
_, widget = viewer.window.add_plugin_dock_widget("napari-metadata")
assert isinstance(widget, MetadataWidget)

0 comments on commit e6da33d

Please sign in to comment.