Skip to content

Commit

Permalink
add framebuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
thorstenwagner committed Aug 7, 2023
1 parent 40a9c0c commit 5ec0680
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools setuptools_scm pylint tox tox-gh-actions pytest pytest-coverage twine build
pip install setuptools setuptools_scm pylint tox tox-gh-actions pytest pytest-coverage pytest-xvfb twine build
pip install .
- name: Debug Info
run: |
Expand Down
26 changes: 24 additions & 2 deletions src/box_manager/_tests/test_organizelayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ def organize_layer_widget_tomo(napari_viewer):
widget, _ = napari_viewer.window.add_plugin_dock_widget('napari-boxmanager', widget_name='organize_layer', tabify=True)
widget.widget()._new_shapes()
yield widget.widget()

@pytest.fixture(scope="function")
def organize_layer_widget_stack(napari_viewer):
rand_vol = np.random.randn(500,500).astype(np.float32)
with tempfile.TemporaryDirectory() as tmpdirname:
with mrcfile.new(f"{tmpdirname}/tmp.mrc") as mrc:
mrc.set_data(rand_vol)
with mrcfile.new(f"{tmpdirname}/tmp_2.mrc") as mrc:
mrc.set_data(rand_vol)
napari_viewer.open(plugin='napari-boxmanager',
path=f"'{tmpdirname}/*.mrc'")
widget, _ = napari_viewer.window.add_plugin_dock_widget('napari-boxmanager', widget_name='organize_layer', tabify=True)
widget.widget()._new_shapes()
yield widget.widget()

@patch(
"qtpy.QtWidgets.QFileDialog.getExistingDirectory",
MagicMock(
Expand All @@ -33,6 +48,13 @@ class Test__run_save:
def test_save_tomo_filament(self, napari_viewer, organize_layer_widget_tomo):
# generate random tomogram
fila = [[77, 50, 50], [77, 100, 100], [77, 200, 200]]
assert len(napari_viewer.layers) == 2
napari_viewer.layers[1]._add_shapes(fila, shape_type='path', edge_width=100)
organize_layer_widget_tomo._run_save()
organize_layer_widget_tomo._run_save()

def test_save_stack_filament(self, napari_viewer, organize_layer_widget_tomo):
# generate random tomogram
fila = [[249, 50, 50], [249, 100, 100], [249, 200, 200]]
napari_viewer.layers[1]._add_shapes(fila, shape_type='path', edge_width=100)
organize_layer_widget_tomo._run_save()

#assert True==False
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ passenv =
XAUTHORITY
NUMPY_EXPERIMENTAL_ARRAY_FUNCTION
PYVISTA_OFF_SCREEN
deps =
pytest-xvfb ; sys_platform == 'linux'
extras =
testing
commands = pytest -v --color=yes --cov=box_manager --cov-report=xml
Expand Down

0 comments on commit 5ec0680

Please sign in to comment.