From b4b9e357ccafb4fac22eef0c7bee90da6ff25b43 Mon Sep 17 00:00:00 2001 From: dchaudhari7177 Date: Sun, 26 Jul 2026 21:34:05 +0530 Subject: [PATCH] tests: skip test_celery when celery/testcontainers are not installed (closes #750) --- tests/test_pytest_cov.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index b291f432..bf7e4537 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -1,5 +1,6 @@ import collections import glob +import importlib.util import os import platform import re @@ -708,8 +709,12 @@ def test_foobar(bad): assert result.ret == 0 +HAS_CELERY = importlib.util.find_spec('celery') is not None and importlib.util.find_spec('testcontainers') is not None + + @pytest.mark.skipif(sys.platform == 'win32', reason='No redis server on Windows') @pytest.mark.skipif(sys.platform == 'darwin', reason='No redis server on OSX') +@pytest.mark.skipif(not HAS_CELERY, reason='celery and testcontainers are required') def test_celery(pytester): pytester.makepyfile( small_celery="""