From 419f8df671f2640332d231cd76a0399561e4a448 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Thu, 21 Nov 2024 17:28:33 +0200 Subject: [PATCH] fix test skips for voikko and spacy analyzers --- tests/test_analyzer_spacy.py | 5 ++++- tests/test_analyzer_voikko.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/test_analyzer_spacy.py b/tests/test_analyzer_spacy.py index bf14a9ae0..e3012af05 100644 --- a/tests/test_analyzer_spacy.py +++ b/tests/test_analyzer_spacy.py @@ -3,9 +3,12 @@ import pytest import annif.analyzer +import annif.analyzer.spacy from annif.exception import OperationFailedException -spacy = pytest.importorskip("spacy") +pytestmark = pytest.mark.skipif( + not annif.analyzer.spacy.SpacyAnalyzer.is_available(), reason="spaCy is required" +) def test_spacy_model_not_found(): diff --git a/tests/test_analyzer_voikko.py b/tests/test_analyzer_voikko.py index 6cba156f7..8598482b1 100644 --- a/tests/test_analyzer_voikko.py +++ b/tests/test_analyzer_voikko.py @@ -3,8 +3,11 @@ import pytest import annif.analyzer +import annif.analyzer.voikko -voikko = pytest.importorskip("annif.analyzer.voikko") +pytestmark = pytest.mark.skipif( + not annif.analyzer.voikko.VoikkoAnalyzer.is_available(), reason="voikko is required" +) def test_voikko_getstate():