skillfed

pytest-celery

Pytest plugin for Celery

pytest-celery v1.3.0 1.9M downloads/30d#3,485 on PyPI82
Permissive license BSD-3-Clause Active released

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-celery

uv

uv add pytest-celery

poetry

poetry add pytest-celery

Installing 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

Development Status :: 5 - Production/StableFramework :: CeleryLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Testing

Tags

pytest plugin for celerycelery testing with dockercelery task testingdistributed task queue testingcelery integration testsproduction-like celery testscelery worker testing
celerydistributed-testingdocker-based

More Testing packages

pluggy

Pluggy provides a plugin system that lets you…

permissive · top 100 on PyPI

pytest

pytest is a testing framework that lets you…

permissive · top 100 on PyPI

virtualenv

virtualenv creates isolated Python environments…

permissive · top 100 on PyPI

coverage

Coverage.py measures which lines of Python code…

permissive · top 1,000 on PyPI

pytest-asyncio

pytest-asyncio is a pytest plugin that enables…

permissive · top 1,000 on PyPI

pytest-json-ctrf

A pytest plugin that generates test reports in…

permissive · top 1,000 on PyPI

celery

Celery is a distributed task queue that lets…

permissive · top 1,000 on PyPI

celery-stubs

Provides type stubs for Celery to enable static…

permissive · top 15,000 on PyPI

opentelemetry-instrumentation-celery

Adds distributed tracing and observability to…

permissive · top 5,000 on PyPI

apache-airflow-providers-celery

Integrates Celery distributed task execution…

permissive · top 5,000 on PyPI

flower

Flower is a web-based monitoring and management…

permissive · top 5,000 on PyPI

pylint-celery

A Pylint plugin that improves static analysis…

copyleft · top 15,000 on PyPI

aa-taskmonitor

A Django admin plugin for Alliance Auth that…

permissive · top 15,000 on PyPI

dvc-task

dvc-task queues and runs background jobs from…

permissive · top 5,000 on PyPI

celery-batches

Celery Batches provides a Task class that…

permissive · top 15,000 on PyPI

celery-progress

Provides drop-in progress bars for Django views…

permissive · top 15,000 on PyPI