Skip to content

Commit

Permalink
Added tests for python scripts in _includes
Browse files Browse the repository at this point in the history
  • Loading branch information
k-dominik committed Apr 25, 2024
1 parent 72c3897 commit 9ab16df
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/test-python-scripts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: test-python-scripts

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test-python-scripts:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
auto-activate-base: true
activate-environment: ""
channel-priority: strict
miniforge-variant: Miniforge
- name: install common conda dependencies
run: conda install -c conda-forge -c euro-bioimaging python=3.10 napari=0.4.17 pytest notebook matplotlib jupytext "scikit-image>=0.20" openijtiff -y
- name: linux test
if: matrix.os == 'ubuntu-latest'
shell: bash -l {0}
run: pytest test_python
- name: osx test
if: matrix.os == 'macos-latest'
shell: bash -l {0}
run: pytest pytest test_python
- name: windows test
if: matrix.os == 'windows-latest'
shell: cmd /C CALL {0}
run: pytest pytest test_python
10 changes: 10 additions & 0 deletions test_python/test_all.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import pathlib
import runpy
import pytest

scripts = map(str, (pathlib.Path(__file__).parent / '..'/ '_includes').resolve().glob('**/*.py'))


@pytest.mark.parametrize('script', scripts)
def test_script_execution(script):
runpy.run_path(script)

0 comments on commit 9ab16df

Please sign in to comment.