Skip to content

Commit

Permalink
Added documentation to all vendors fixtures (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nusnus authored Feb 11, 2024
1 parent 264913c commit ac13550
Show file tree
Hide file tree
Showing 5 changed files with 259 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/pytest_celery/vendors/memcached/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ def celery_memcached_backend(default_memcached_backend: MemcachedContainer) -> M

@pytest.fixture
def default_memcached_backend_cls() -> type[MemcachedContainer]:
"""Default Memcached backend container class. Override to apply custom
configuration globally.
See also: :ref:`vendor-class`.
Returns:
type[MemcachedContainer]: API for managing the vendor's container.
"""
return MemcachedContainer


Expand All @@ -47,14 +55,38 @@ def default_memcached_backend_cls() -> type[MemcachedContainer]:

@pytest.fixture
def default_memcached_backend_env(default_memcached_backend_cls: type[MemcachedContainer]) -> dict:
"""Environment variables for this vendor.
Args:
default_memcached_backend_cls (type[MemcachedContainer]): See also: :ref:`vendor-class`.
Returns:
dict: Items to pass to the container's environment.
"""
return default_memcached_backend_cls.env()


@pytest.fixture
def default_memcached_backend_image(default_memcached_backend_cls: type[MemcachedContainer]) -> str:
"""Docker image for this vendor.
Args:
default_memcached_backend_cls (type[MemcachedContainer]): See also: :ref:`vendor-class`.
Returns:
str: Docker image name.
"""
return default_memcached_backend_cls.image()


@pytest.fixture
def default_memcached_backend_ports(default_memcached_backend_cls: type[MemcachedContainer]) -> dict:
"""Port bindings for this vendor.
Args:
default_memcached_backend_cls (type[MemcachedContainer]): See also: :ref:`vendor-class`.
Returns:
dict: Port bindings.
"""
return default_memcached_backend_cls.ports()
32 changes: 32 additions & 0 deletions src/pytest_celery/vendors/rabbitmq/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ def celery_rabbitmq_broker(default_rabbitmq_broker: RabbitMQContainer) -> Rabbit

@pytest.fixture
def default_rabbitmq_broker_cls() -> type[RabbitMQContainer]:
"""Default RabbitMQ broker container class. Override to apply custom
configuration globally.
See also: :ref:`vendor-class`.
Returns:
type[RabbitMQContainer]: API for managing the vendor's container.
"""
return RabbitMQContainer


Expand All @@ -47,14 +55,38 @@ def default_rabbitmq_broker_cls() -> type[RabbitMQContainer]:

@pytest.fixture
def default_rabbitmq_broker_env(default_rabbitmq_broker_cls: type[RabbitMQContainer]) -> dict:
"""Environment variables for this vendor.
Args:
default_rabbitmq_broker_cls (type[RabbitMQContainer]): See also: :ref:`vendor-class`.
Returns:
dict: Items to pass to the container's environment.
"""
return default_rabbitmq_broker_cls.env()


@pytest.fixture
def default_rabbitmq_broker_image(default_rabbitmq_broker_cls: type[RabbitMQContainer]) -> str:
"""Sets the image name for this vendor.
Args:
default_rabbitmq_broker_cls (type[RabbitMQContainer]): See also: :ref:`vendor-class`.
Returns:
str: Docker image name.
"""
return default_rabbitmq_broker_cls.image()


@pytest.fixture
def default_rabbitmq_broker_ports(default_rabbitmq_broker_cls: type[RabbitMQContainer]) -> dict:
"""Port bindings for this vendor.
Args:
default_rabbitmq_broker_cls (type[RabbitMQContainer]): See also: :ref:`vendor-class`.
Returns:
dict: Port bindings.
"""
return default_rabbitmq_broker_cls.ports()
32 changes: 32 additions & 0 deletions src/pytest_celery/vendors/redis/backend/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ def celery_redis_backend(default_redis_backend: RedisContainer) -> RedisTestBack

@pytest.fixture
def default_redis_backend_cls() -> type[RedisContainer]:
"""Default Redis backend container class. Override to apply custom
configuration globally.
See also: :ref:`vendor-class`.
Returns:
type[RedisContainer]: API for managing the vendor's container.
"""
return RedisContainer


Expand All @@ -48,14 +56,38 @@ def default_redis_backend_cls() -> type[RedisContainer]:

@pytest.fixture
def default_redis_backend_env(default_redis_backend_cls: type[RedisContainer]) -> dict:
"""Environment variables for this vendor.
Args:
default_rabbitmq_broker_cls (type[RedisContainer]): See also: :ref:`vendor-class`.
Returns:
dict: Items to pass to the container's environment.
"""
return default_redis_backend_cls.env()


@pytest.fixture
def default_redis_backend_image(default_redis_backend_cls: type[RedisContainer]) -> str:
"""Sets the image name for this vendor.
Args:
default_rabbitmq_broker_cls (type[RedisContainer]): See also: :ref:`vendor-class`.
Returns:
str: Docker image name.
"""
return default_redis_backend_cls.image()


@pytest.fixture
def default_redis_backend_ports(default_redis_backend_cls: type[RedisContainer]) -> dict:
"""Port bindings for this vendor.
Args:
default_redis_backend_cls (type[RedisContainer]): See also: :ref:`vendor-class`.
Returns:
dict: Port bindings.
"""
return default_redis_backend_cls.ports()
32 changes: 32 additions & 0 deletions src/pytest_celery/vendors/redis/broker/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ def celery_redis_broker(default_redis_broker: RedisContainer) -> RedisTestBroker

@pytest.fixture
def default_redis_broker_cls() -> type[RedisContainer]:
"""Default Redis broker container class. Override to apply custom
configuration globally.
See also: :ref:`vendor-class`.
Returns:
type[RedisContainer]: API for managing the vendor's container.
"""
return RedisContainer


Expand All @@ -48,14 +56,38 @@ def default_redis_broker_cls() -> type[RedisContainer]:

@pytest.fixture
def default_redis_broker_env(default_redis_broker_cls: type[RedisContainer]) -> dict:
"""Environment variables for this vendor.
Args:
default_rabbitmq_broker_cls (type[RedisContainer]): See also: :ref:`vendor-class`.
Returns:
dict: Items to pass to the container's environment.
"""
return default_redis_broker_cls.env()


@pytest.fixture
def default_redis_broker_image(default_redis_broker_cls: type[RedisContainer]) -> str:
"""Sets the image name for this vendor.
Args:
default_rabbitmq_broker_cls (type[RedisContainer]): See also: :ref:`vendor-class`.
Returns:
str: Docker image name.
"""
return default_redis_broker_cls.image()


@pytest.fixture
def default_redis_broker_ports(default_redis_broker_cls: type[RedisContainer]) -> dict:
"""Port bindings for this vendor.
Args:
default_redis_broker_cls (type[RedisContainer]): See also: :ref:`vendor-class`.
Returns:
dict: Port bindings.
"""
return default_redis_broker_cls.ports()
Loading

0 comments on commit ac13550

Please sign in to comment.