diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index 2e7abfe82c5d57366961fa98b77e64f6c7436712..c3b19eb4571a3370559a82288d0968ba37611aaa 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -7,13 +7,13 @@ on: push: branches: - main - - npe2 + - interactive-widget tags: - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 pull_request: branches: - main - - npe2 + - interactive-widget workflow_dispatch: jobs: diff --git a/setup.cfg b/setup.cfg index 441c1e836c6e57f81d99abf184577bdc7a8f65c9..29c0cdf983b55ad17b08578afa8b5ee75c4de70b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,6 +35,9 @@ install_requires = numpy scikit-image zarr + matplotlib + dask + imageio_ffmpeg python_requires = >=3.8 include_package_data = True package_dir = diff --git a/src/napari_segment/_tests/test_dock_widget.py b/src/napari_segment/_tests/test_dock_widget.py deleted file mode 100644 index db9e6e4127d03a94834b9ed91a807e1a011e32a1..0000000000000000000000000000000000000000 --- a/src/napari_segment/_tests/test_dock_widget.py +++ /dev/null @@ -1,33 +0,0 @@ -from napari_segment import ExampleQWidget, example_magic_widget -import numpy as np - -# make_napari_viewer is a pytest fixture that returns a napari viewer object -# capsys is a pytest fixture that captures stdout and stderr output streams -def test_example_q_widget(make_napari_viewer, capsys): - # make viewer and add an image layer using our fixture - viewer = make_napari_viewer() - viewer.add_image(np.random.random((100, 100))) - - # create our widget, passing in the viewer - my_widget = ExampleQWidget(viewer) - - # call our widget method - my_widget._on_click() - - # read captured output and check that it's as we expected - captured = capsys.readouterr() - assert captured.out == "napari has 1 layers\n" - -def test_example_magic_widget(make_napari_viewer, capsys): - viewer = make_napari_viewer() - layer = viewer.add_image(np.random.random((100, 100))) - - # this time, our widget will be a MagicFactory or FunctionGui instance - my_widget = example_magic_widget() - - # if we "call" this object, it'll execute our function - my_widget(viewer.layers[0]) - - # read captured output and check that it's as we expected - captured = capsys.readouterr() - assert captured.out == f"you have selected {layer}\n" diff --git a/src/napari_segment/_tests/test_widget.py b/src/napari_segment/_tests/test_widget.py index db9e6e4127d03a94834b9ed91a807e1a011e32a1..2dd4374eb50452c1b5bfa18cb5c19515e27a1d6d 100644 --- a/src/napari_segment/_tests/test_widget.py +++ b/src/napari_segment/_tests/test_widget.py @@ -1,33 +1,22 @@ -from napari_segment import ExampleQWidget, example_magic_widget +from napari_segment import SegmentStack import numpy as np +import dask.array as da # make_napari_viewer is a pytest fixture that returns a napari viewer object # capsys is a pytest fixture that captures stdout and stderr output streams -def test_example_q_widget(make_napari_viewer, capsys): +def test_segment_stack(make_napari_viewer, capsys): # make viewer and add an image layer using our fixture viewer = make_napari_viewer() - viewer.add_image(np.random.random((100, 100))) + viewer.add_image(np.random.random((5, 100, 100)), name="test_data", metadata={"path": "fakepath.nd2"}) # create our widget, passing in the viewer - my_widget = ExampleQWidget(viewer) + widget = SegmentStack(viewer) + assert widget.input.current_choice == "test_data" + assert widget.path == "fakepath.nd2" + assert isinstance(widget.ddata, da.Array) + assert widget.ddata.chunks == ((1, 1, 1, 1, 1), (100/widget.binning,), (100/widget.binning,)) - # call our widget method - my_widget._on_click() - - # read captured output and check that it's as we expected - captured = capsys.readouterr() - assert captured.out == "napari has 1 layers\n" -def test_example_magic_widget(make_napari_viewer, capsys): - viewer = make_napari_viewer() - layer = viewer.add_image(np.random.random((100, 100))) - - # this time, our widget will be a MagicFactory or FunctionGui instance - my_widget = example_magic_widget() - - # if we "call" this object, it'll execute our function - my_widget(viewer.layers[0]) - # read captured output and check that it's as we expected - captured = capsys.readouterr() - assert captured.out == f"you have selected {layer}\n" + # captured = capsys.readouterr() + # assert captured.out == "napari has 1 layers\n"