Skip to content

Commit 26b0d85

Browse files
committed
skip tests if pyflowsom not installed
1 parent 1200f7a commit 26b0d85

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ optional-dependencies.doc = [
6666
"sphinxcontrib-bibtex>=1",
6767
"sphinxext-opengraph",
6868
]
69-
optional-dependencies.test = [ "coverage", "pytest" ]
69+
optional-dependencies.test = [ "coverage", "pyflowsom", "pytest" ]
7070
urls.Documentation = "https://flowsom.readthedocs.io/en/latest/"
7171
urls.Home-page = "https://github.com/saeyslab/FlowSOM_Python"
7272
urls.Source = "https://github.com/saeyslab/FlowSOM_Python"

tests/models/test_pyFlowSOM.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import pytest
22
from sklearn.metrics import v_measure_score
33

4-
# optional import if pyFlowSOM is installed, otherwise use regular FlowSOM for type checking
4+
# Skip the entire test file if pyflowsom is not installed
5+
pytest.importorskip("pyFlowSOM", reason="pyflowsom is not installed")
6+
57
try:
68
from flowsom.models.pyflowsom_estimator import PyFlowSOMEstimator
79
except ImportError:
810
from flowsom.models import FlowSOMEstimator as PyFlowSOMEstimator
911

1012

11-
@pytest.importorskip("flowsom.models.pyflowsom_estimator")
1213
def test_clustering(X):
1314
fsom = PyFlowSOMEstimator(n_clusters=10)
1415
y_pred = fsom.fit_predict(X)
1516
assert y_pred.shape == (100,)
1617

1718

18-
@pytest.importorskip("flowsom.models.pyflowsom_estimator")
1919
def test_clustering_v_measure(X_and_y):
2020
som = PyFlowSOMEstimator(n_clusters=10)
2121
X, y_true = X_and_y
@@ -24,7 +24,6 @@ def test_clustering_v_measure(X_and_y):
2424
assert score > 0.7
2525

2626

27-
@pytest.importorskip("flowsom.models.pyflowsom_estimator")
2827
def test_reproducibility_no_seed(X):
2928
fsom_1 = PyFlowSOMEstimator(n_clusters=10)
3029
fsom_2 = PyFlowSOMEstimator(n_clusters=10)
@@ -34,7 +33,6 @@ def test_reproducibility_no_seed(X):
3433
assert not all(y_pred_1 == y_pred_2)
3534

3635

37-
@pytest.importorskip("flowsom.models.pyflowsom_estimator")
3836
def test_reproducibility_seed(X):
3937
fsom_1 = PyFlowSOMEstimator(n_clusters=10, seed=0)
4038
fsom_2 = PyFlowSOMEstimator(n_clusters=10, seed=0)

0 commit comments

Comments
 (0)