From d8ea2b49151a4b454d5676e240ca84718235d95c Mon Sep 17 00:00:00 2001 From: nbokulich Date: Fri, 7 Jun 2024 13:40:04 +0200 Subject: [PATCH] TEMPFIX: skip unit tests that rely on q2-longitudinal if it is not installed --- rescript/tests/test_cross_validate.py | 8 ++++++++ rescript/tests/test_evaluate.py | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/rescript/tests/test_cross_validate.py b/rescript/tests/test_cross_validate.py index 1c85575..8576d87 100644 --- a/rescript/tests/test_cross_validate.py +++ b/rescript/tests/test_cross_validate.py @@ -13,13 +13,21 @@ import qiime2 import pandas as pd import pandas.testing as pdt +import pytest from rescript import cross_validate import_data = qiime2.Artifact.import_data +try: + from qiime2.plugins import longitudinal + import_q2l = True +except ImportError: + import_q2l = False + +@pytest.mark.skipif(not import_q2l, reason="requires q2-longitudinal") class TestPipelines(TestPluginBase): package = 'rescript.tests' diff --git a/rescript/tests/test_evaluate.py b/rescript/tests/test_evaluate.py index 6bad4ff..8824c6c 100644 --- a/rescript/tests/test_evaluate.py +++ b/rescript/tests/test_evaluate.py @@ -13,12 +13,19 @@ import numpy as np import pandas.testing as pdt from q2_types.feature_data import DNAIterator +import pytest from rescript import evaluate import_data = qiime2.Artifact.import_data +try: + from qiime2.plugins import longitudinal + import_q2l = True +except ImportError: + import_q2l = False + class TestEvaluateUtilities(TestPluginBase): package = 'rescript.tests' @@ -56,7 +63,9 @@ def setUp(self): self.taxa = import_data( 'FeatureData[Taxonomy]', self.get_data_path('derep-taxa.tsv')) - # this just tests that the pipeline runs, other tests test proper function + # This just tests that the pipeline runs, other tests test proper function. + # We skip this if q2-longitudinal is not installed. + @pytest.mark.skipif(not import_q2l, reason="requires q2-longitudinal") def test_pipeline(self): rescript.actions.evaluate_taxonomy([self.taxa], ["name"], "")