Skip to content

Commit 1897f8b

Browse files
committed
tests: skip sortingview tests if kachery is not installed
1 parent d52575d commit 1897f8b

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/spikeinterface/curation/tests/test_sortingview_curation.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import json
55
import numpy as np
6+
import importlib.util
67

78
import spikeinterface as si
89
from spikeinterface.core import generate_sorting
@@ -20,6 +21,14 @@
2021
ON_GITHUB = bool(os.getenv("GITHUB_ACTIONS"))
2122
KACHERY_CLOUD_SET = bool(os.getenv("KACHERY_API_KEY"))
2223

24+
kachery_spec = importlib.util.find_spec("kachery")
25+
if kachery_spec is not None:
26+
HAVE_KACHERY = True
27+
else:
28+
HAVE_KACHERY = False
29+
30+
31+
SKIP_KACHERY_REMOTE = not HAVE_KACHERY or (ON_GITHUB and not KACHERY_CLOUD_SET)
2332

2433
# this needs to be run only once: if we want to regenerate we need to start with sorting result
2534
# TODO : regenerate the
@@ -43,7 +52,7 @@
4352
# # https://figurl.org/f?v=npm://@fi-sci/figurl-sortingview@12/dist&d=sha1://058ab901610aa9d29df565595a3cc2a81a1b08e5
4453

4554

46-
@pytest.mark.skipif(ON_GITHUB and not KACHERY_CLOUD_SET, reason="Kachery cloud secrets not available")
55+
@pytest.mark.skipif(SKIP_KACHERY_REMOTE, reason="Kachery cloud secrets not available")
4756
def test_gh_curation():
4857
"""
4958
Test curation using GitHub URI.
@@ -73,7 +82,7 @@ def test_gh_curation():
7382
assert len(sorting_curated_gh_art_mua.unit_ids) == 5
7483

7584

76-
@pytest.mark.skipif(ON_GITHUB and not KACHERY_CLOUD_SET, reason="Kachery cloud secrets not available")
85+
@pytest.mark.skipif(SKIP_KACHERY_REMOTE, reason="Kachery cloud secrets not available")
7786
def test_sha1_curation():
7887
"""
7988
Test curation using SHA1 URI.

0 commit comments

Comments
 (0)