This document describes the current stable version of pytest_celery (1.0). For development docs, go here.

pytest_celery.vendors.redis package

Subpackages

Submodules

pytest_celery.vendors.redis.container module

The pytest-celery plugin provides a set of built-in components called Vendors.

This module is part of the Redis vendor.

class pytest_celery.vendors.redis.container.RedisContainer(container)[source]

Bases: CeleryTestContainer

This class manages the lifecycle of a Redis container.

property celeryconfig: dict

Each container is responsible for providing the configuration values required for Celery. This property should be implemented to return the configuration values for the specific container.

Raises:

NotImplementedError – There is no config available by default.

Returns:

Configuration values required for Celery.

Return type:

dict

property client: Redis | None

Provides an API client for interacting with the container, if available.

Subclasses should implement this to return an instance of the client specific to the service running in the container.

Raises:

NotImplementedError – There is not client available by default.

Returns:

Client instance.

Return type:

Any

classmethod command(*args: str, debugpy: bool = False, wait_for_client: bool = True, **kwargs: dict) list[str][source]

Override the CMD instruction in the Dockerfile.

This method should be overridden in derived classes to provide the specific command and its arguments required to start the container.

Parameters:
  • *args (str) – Additional command-line arguments.

  • debugpy (bool) – Enable debugpy. Defaults to False.

  • wait_for_client (bool) – Wait for a debugger to be attached. Defaults to True.

  • **kwargs (dict) – Additional keyword arguments.

Raises:

NotImplementedError – Rely on the Dockerfile if not set otherwise by default.

Returns:

A list containing the command to run in the container as

the first element, followed by the command-line arguments.

Return type:

list[str]

property host_url: str
property hostname: str
classmethod image() str[source]
classmethod initial_env() dict[source]
property port: int
classmethod ports() dict[source]
classmethod prefix() str[source]
property ready_prompt: str | None

A log string that indicates the container has finished starting up and is ready to use.

Returns:

A string to wait for or None for no wait. Defaults to None.

Return type:

str | None

property url: str
classmethod version() str[source]
property vhost: str

pytest_celery.vendors.redis.defaults module

The pytest-celery plugin provides a set of built-in components called Vendors.

This module is part of the Redis vendor.

Module contents

The pytest-celery plugin provides a set of built-in components called Vendors.

This module is part of the Redis vendor.