diff --git a/tests/conftest.py b/tests/conftest.py index 385d9ce8cb..55c3b03605 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1080,6 +1080,32 @@ def openai_fixture(fail_missing: bool): yield import_or_skip("openai", reason=OPT_DEP_SKIP_REASON.format(package="openai"), fail_missing=fail_missing) +@pytest.fixture(scope='session') +def dask_distributed(fail_missing: bool): + """ + Mark tests requiring dask.distributed + """ + yield import_or_skip("dask.distributed", + reason=OPT_DEP_SKIP_REASON.format(package="dask.distributed"), + fail_missing=fail_missing) + + +@pytest.fixture(scope='session') +def dask_cuda(fail_missing: bool): + """ + Mark tests requiring dask_cuda + """ + yield import_or_skip("dask_cuda", reason=OPT_DEP_SKIP_REASON.format(package="dask_cuda"), fail_missing=fail_missing) + + +@pytest.fixture(scope='session') +def mlflow(fail_missing: bool): + """ + Mark tests requiring mlflow + """ + yield import_or_skip("mlflow", reason=OPT_DEP_SKIP_REASON.format(package="mlflow"), fail_missing=fail_missing) + + @pytest.fixture(name="langchain", scope='session') def langchain_fixture(fail_missing: bool): """ diff --git a/tests/examples/ransomware_detection/conftest.py b/tests/examples/ransomware_detection/conftest.py index ef3e8660c7..7c3ca3e74e 100644 --- a/tests/examples/ransomware_detection/conftest.py +++ b/tests/examples/ransomware_detection/conftest.py @@ -20,7 +20,6 @@ import yaml from _utils import TEST_DIRS -from _utils import import_or_skip from _utils import remove_module # pylint: disable=redefined-outer-name @@ -30,12 +29,12 @@ "for details on installing these additional dependencies") -@pytest.fixture(autouse=True, scope='session') -def dask_distributed(fail_missing: bool): +@pytest.fixture(name="dask_distributed", autouse=True, scope='session') +def dask_distributed_fixture(dask_distributed): """ All of the tests in this subdir requires dask.distributed """ - yield import_or_skip("dask.distributed", reason=SKIP_REASON, fail_missing=fail_missing) + yield dask_distributed @pytest.fixture(name="config") diff --git a/tests/morpheus/utils/test_downloader.py b/tests/morpheus/utils/test_downloader.py index 451c6cde64..9cc8306568 100644 --- a/tests/morpheus/utils/test_downloader.py +++ b/tests/morpheus/utils/test_downloader.py @@ -22,20 +22,17 @@ import morpheus.utils.downloader from _utils import TEST_DIRS -from _utils import import_or_skip from morpheus.utils.downloader import DOWNLOAD_METHODS_MAP from morpheus.utils.downloader import Downloader from morpheus.utils.downloader import DownloadMethods -@pytest.fixture(autouse=True, scope='session') -def dask_distributed(fail_missing: bool): +@pytest.fixture(name="dask_distributed", autouse=True, scope='session') +def dask_distributed_fixture(dask_distributed): """ Mark tests requiring dask.distributed """ - yield import_or_skip("dask.distributed", - reason="Downloader requires dask and dask.distributed", - fail_missing=fail_missing) + yield dask_distributed @pytest.mark.usefixtures("restore_environ") diff --git a/tests/morpheus_dfp/conftest.py b/tests/morpheus_dfp/conftest.py index c441a24e6b..6ec5280ec5 100644 --- a/tests/morpheus_dfp/conftest.py +++ b/tests/morpheus_dfp/conftest.py @@ -30,28 +30,28 @@ "Morpheus development environment.") -@pytest.fixture(autouse=True, scope='session') -def dask_distributed(fail_missing: bool): +@pytest.fixture(name="dask_distributed", autouse=True, scope='session') +def dask_distributed_fixture(dask_distributed): """ Mark tests requiring dask.distributed """ - yield import_or_skip("dask.distributed", reason=SKIP_REASON, fail_missing=fail_missing) + yield dask_distributed -@pytest.fixture(autouse=True, scope='session') -def dask_cuda(fail_missing: bool): +@pytest.fixture(name="dask_cuda", autouse=True, scope='session') +def dask_cuda_fixture(dask_cuda): """ - Mark tests requiring dask.distributed + Mark tests requiring dask_cuda """ - yield import_or_skip("dask_cuda", reason=SKIP_REASON, fail_missing=fail_missing) + yield dask_cuda -@pytest.fixture(autouse=True, scope='session') -def mlflow(fail_missing: bool): +@pytest.fixture(name="mlflow", autouse=True, scope='session') +def mlflow_fixture(mlflow): """ Mark tests requiring mlflow """ - yield import_or_skip("mlflow", reason=SKIP_REASON, fail_missing=fail_missing) + yield mlflow @pytest.fixture(name='ae_feature_cols', scope='session')