pytest-celery
Pytest plugin for Celery
What it is and what it does
pytest-celery is the official testing plugin for Celery, the distributed task queue framework. It provides pytest fixtures and utilities to test Celery applications in two modes: traditional unit and integration testing via the celery.contrib.pytest API, and a newer Docker-based approach (introduced in version 1.0.0+) for smoke and production-like testing. The Docker-based methodology lets you spin up isolated Celery workers and brokers in containers, making it possible to test your tasks and application logic in environments that closely mirror production without affecting existing tests.
The plugin depends on celery, docker, kombu, debugpy, psutil, tenacity, and pytest-docker-tools. It supports Python 3.9 through 3.14 and is actively maintained. The low-friction install and production-stable status make it a straightforward addition to Celery-based projects that need comprehensive test coverage.
Use it for:
- Test Celery tasks in isolated Docker containers to verify behavior in production-like conditions before deployment.
- Write integration tests that spin up temporary Celery workers and brokers to validate task execution and message flow.
- Debug Celery application issues by running tests with debugpy attached to worker processes inside containers.
- Validate task retries, error handling, and signal handlers in a controlled Docker environment.
- Test multiple Celery workers and broker configurations without manual setup or teardown.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pytest-celery is the official pytest plugin for Celery that enables testing of Celery applications using Docker-based environments to simulate production-like conditions, alongside traditional unit and integration testing APIs.
Yes, if you are testing a Celery application. pytest-celery is the official plugin, actively maintained, production-stable, and has no known vulnerabilities. The Docker-based testing approach (1.0.0+) is a significant enhancement for production-like validation. Low install friction and permissive licensing make it a straightforward choice for any Celery project.
Install
pytest-celery on PyPI
pip
pip install pytest-celeryuv
uv add pytest-celerypoetry
poetry add pytest-celeryInstalling pytest-celery
Before you install
Low friction install with a pure-Python wheel. Actively maintained with recent commits and production-stable status. Depends on celery, docker, and pytest-docker-tools, which are standard testing dependencies.
License in practice
BSD-3-Clause is permissive and imposes no restrictions on use or redistribution; safe for commercial and open-source projects alike.
Quickstart
pip install pytest-celery
import pytest
from pytest_celery import celery_app, celery_worker
def test_celery_task(celery_app, celery_worker):
# Use fixtures to test Celery tasks
pass
Docker must be installed and running; requires Python 3.9 or later.
Verify before relying
- Whether the Docker-based approach requires specific Docker daemon configuration or network setup beyond standard Docker installation.
- Performance characteristics and overhead of Docker-based testing compared to traditional unit tests.
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (<4.0,>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 7 — celery, debugpy, docker, kombu, psutil, pytest-docker-tools, tenacity |
| Maintenance | actively maintained — 165 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,859,167/month — #3,485 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_celery-1.3.0-py3-none-any.whl
Keywords: pytest, celery
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
celeryCelery is a distributed task queue that lets…
permissive · top 1,000 on PyPI
celery-stubsProvides type stubs for Celery to enable static…
permissive · top 15,000 on PyPI
opentelemetry-instrumentation-celeryAdds distributed tracing and observability to…
permissive · top 5,000 on PyPI
apache-airflow-providers-celeryIntegrates Celery distributed task execution…
permissive · top 5,000 on PyPI
flowerFlower is a web-based monitoring and management…
permissive · top 5,000 on PyPI
pylint-celeryA Pylint plugin that improves static analysis…
copyleft · top 15,000 on PyPI
aa-taskmonitorA Django admin plugin for Alliance Auth that…
permissive · top 15,000 on PyPI
dvc-taskdvc-task queues and runs background jobs from…
permissive · top 5,000 on PyPI
celery-batchesCelery Batches provides a Task class that…
permissive · top 15,000 on PyPI
celery-progressProvides drop-in progress bars for Django views…
permissive · top 15,000 on PyPI