Skip to content

Commit

Permalink
Merge pull request #41 from Tauffer-Consulting/ci-tests
Browse files Browse the repository at this point in the history
Tests-CI
  • Loading branch information
alejoe91 authored Jun 26, 2022
2 parents 3d2bb21 + 5556fa9 commit b47a18c
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/test_containers_singularity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test sorter images in singularity

on:
workflow_dispatch:
pull_request:
branches: [main]
types: [synchronize, opened, reopened, ready_for_review]

jobs:
test-images:
name: Test on (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# "macos-latest", "windows-latest"
os: ["ubuntu-latest", ]
steps:
- uses: actions/checkout@v3
with:
python-version: 3.8

- uses: eWaterCycle/setup-singularity@v7
with:
singularity-version: 3.8.3

- name: Install dependencies
run: |
pip install tridesclous
pip install -r requirements_test.txt
- name: Run test singularity containers
run: |
pip install tridesclous
pytest -sv tests/test_singularity_containers.py
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__
4 changes: 4 additions & 0 deletions requirements_test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
git+https://github.com/SpikeInterface/spikeinterface.git#egg=spikeinterface[full]
docker==5.0.3
spython==0.2.1
pytest==7.1.2
101 changes: 101 additions & 0 deletions tests/test_singularity_containers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import os
import shutil

import pytest

import spikeinterface.extractors as se
import spikeinterface.sorters as ss

os.environ['SINGULARITY_DISABLE_CACHE'] = 'true'


@pytest.fixture(autouse=True)
def work_dir(request, tmp_path):
"""
This fixture, along with "run_kwargs" creates one folder per
test function using built-in tmp_path pytest fixture
The tmp_path will be the working directory for the test function
At the end of the each test function, a clean up will be done
"""
os.chdir(tmp_path)
yield
os.chdir(request.config.invocation_dir)
shutil.rmtree(str(tmp_path))


@pytest.fixture
def run_kwargs(work_dir):
test_recording, _ = se.toy_example(
duration=30,
seed=0,
num_channels=64,
num_segments=1
)
test_recording = test_recording.save(name='toy')
return dict(recording=test_recording, verbose=True, singularity_image=True)


def test_spykingcircus(run_kwargs):
sorting = ss.run_spykingcircus(output_folder="spykingcircus", **run_kwargs)
print(sorting)


def test_mountainsort4(run_kwargs):
sorting = ss.run_mountainsort4(output_folder="mountainsort4", **run_kwargs)
print(sorting)


def test_tridesclous(run_kwargs):
sorting = ss.run_tridesclous(output_folder="tridesclous", **run_kwargs)
print(sorting)


def test_klusta(run_kwargs):
sorting = ss.run_klusta(output_folder="klusta", **run_kwargs)
print(sorting)


def test_ironclust(run_kwargs):
sorting = ss.run_ironclust(output_folder="ironclust", fGpu=False, **run_kwargs)
print(sorting)


def test_waveclus(run_kwargs):
sorting = ss.run_waveclus(output_folder="waveclus", **run_kwargs)
print(sorting)


def test_hdsort(run_kwargs):
sorting = ss.run_hdsort(output_folder="hdsort", **run_kwargs)
print(sorting)


def test_kilosort1(run_kwargs):
sorting = ss.run_kilosort(output_folder="kilosort", useGPU=False, **run_kwargs)
print(sorting)


@pytest.mark.skip(reason="GPU required")
def test_kilosort2(run_kwargs):
sorting = ss.run_kilosort2(output_folder="kilosort2", **run_kwargs)
print(sorting)


@pytest.mark.skip(reason="GPU required")
def test_kilosort2_5(run_kwargs):
sorting = ss.run_kilosort2_5(output_folder="kilosort2_5", **run_kwargs)
print(sorting)


@pytest.mark.skip(reason="GPU required")
def test_kilosort3(run_kwargs):
sorting = ss.run_kilosort3(output_folder="kilosort3", **run_kwargs)
print(sorting)


@pytest.mark.skip(reason="GPU required")
def test_pykilosort(run_kwargs):
sorting = ss.run_pykilosort(output_folder="pykilosort", **run_kwargs)
print(sorting)

0 comments on commit b47a18c

Please sign in to comment.