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

pytest_celery.vendors.rabbitmq package

Submodules

pytest_celery.vendors.rabbitmq.api module

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

This module is part of the RabbitMQ Broker vendor.

class pytest_celery.vendors.rabbitmq.api.RabbitMQTestBroker(container: CeleryTestContainer, app: Celery = None)[source]

Bases: CeleryTestBroker

pytest_celery.vendors.rabbitmq.container module

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

This module is part of the RabbitMQ Broker vendor.

class pytest_celery.vendors.rabbitmq.container.RabbitMQContainer(container)[source]

Bases: CeleryTestContainer

This class manages the lifecycle of a RabbitMQ 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: Connection

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

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.rabbitmq.defaults module

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

This module is part of the RabbitMQ Broker vendor.

pytest_celery.vendors.rabbitmq.fixtures module

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

This module is part of the RabbitMQ Broker vendor.

pytest_celery.vendors.rabbitmq.fixtures.celery_rabbitmq_broker(default_rabbitmq_broker: RabbitMQContainer) RabbitMQTestBroker[source]

Creates a RabbitMQTestBroker instance. Responsible for tearing down the node.

Parameters:

default_rabbitmq_broker (RabbitMQContainer) – Instantiated RabbitMQContainer.

pytest_celery.vendors.rabbitmq.fixtures.default_rabbitmq_broker_cls() type[RabbitMQContainer][source]

Default RabbitMQ broker container class. Override to apply custom configuration globally.

See also: Vendor Class.

Returns:

API for managing the vendor’s container.

Return type:

type[RabbitMQContainer]

pytest_celery.vendors.rabbitmq.fixtures.default_rabbitmq_broker_env(default_rabbitmq_broker_cls: type[RabbitMQContainer]) dict[source]

Environment variables for this vendor.

Parameters:

default_rabbitmq_broker_cls (type[RabbitMQContainer]) – See also: Vendor Class.

Returns:

Items to pass to the container’s environment.

Return type:

dict

pytest_celery.vendors.rabbitmq.fixtures.default_rabbitmq_broker_image(default_rabbitmq_broker_cls: type[RabbitMQContainer]) str[source]

Sets the image name for this vendor.

Parameters:

default_rabbitmq_broker_cls (type[RabbitMQContainer]) – See also: Vendor Class.

Returns:

Docker image name.

Return type:

str

pytest_celery.vendors.rabbitmq.fixtures.default_rabbitmq_broker_ports(default_rabbitmq_broker_cls: type[RabbitMQContainer]) dict[source]

Port bindings for this vendor.

Parameters:

default_rabbitmq_broker_cls (type[RabbitMQContainer]) – See also: Vendor Class.

Returns:

Port bindings.

Return type:

dict

Module contents

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

This module is part of the RabbitMQ Broker vendor.