Skip to content

Commit 264913c

Browse files
authored
Documentation Enhancement (#192)
* Added module docstring to src/pytest_celery/api/* * Added module docstring to src/pytest_celery/fixtures/* * Added module docstring to src/pytest_celery/vendors/* * Enhacned docs/glossary.rst
1 parent 58a25a6 commit 264913c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+489
-235
lines changed

docs/getting-started/first-steps.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -800,8 +800,8 @@ Next, we'll configure a single backend setup using the built-in Redis backend, i
800800
.. code-block:: python
801801
802802
@pytest.fixture
803-
def celery_backend_cluster(celery_redis_broker: RedisTestBroker) -> CeleryBrokerCluster:
804-
cluster = CeleryBrokerCluster(celery_redis_broker)
803+
def celery_backend_cluster(celery_redis_backend: RedisTestBackend) -> CeleryBackendCluster:
804+
cluster = CeleryBackendCluster(celery_redis_backend)
805805
yield cluster
806806
cluster.teardown()
807807
@@ -837,7 +837,7 @@ In our test case, we'll assert our setup is configured as expected, and publish
837837
838838
def test_hello_world(celery_setup: CeleryTestSetup):
839839
assert isinstance(celery_setup.broker, RabbitMQTestBroker)
840-
assert isinstance(celery_setup.backend, RedisTestBroker)
840+
assert isinstance(celery_setup.backend, RedisTestBackend)
841841
assert noop.s().apply_async().get() is None
842842
843843
test_helloworld.py

docs/glossary.rst

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ Glossary
99
tbd
1010
To be defined.
1111

12+
container
13+
A container in the context of pytest-celery is a low level implementation of a Celery architecture
14+
component.
15+
16+
node
17+
A node in the context of pytest-celery is a high level implementation of a Celery architecture
18+
component.
19+
20+
component
21+
Celery architecture component that is defined using a container, a node, APIs & pytest fixtures.
22+
It is a collective name for all of the parts that compose a component, according to the pytest-celery
23+
design.
24+
1225
vendor
13-
A Celery-related technology provider. This can refer to the
14-
built-in components, or third-party extensions.
26+
Independent built-in components provided by the plugin. Vendors can be used as-is,
27+
reconfigured, extended or overridden completely by the user.

poetry.lock

Lines changed: 204 additions & 229 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/pytest_celery/api/backend.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
"""Backend components represents Celery's result backend instances.
2+
3+
This module provides the base API for creating new backend components by
4+
defining the base classes for backend nodes and clusters.
5+
"""
6+
17
from __future__ import annotations
28

39
from pytest_celery.api.base import CeleryTestCluster
@@ -15,6 +21,7 @@ class CeleryTestBackend(CeleryTestNode):
1521

1622
@classmethod
1723
def default_config(cls) -> dict:
24+
"""Default node configurations if not overridden by the user."""
1825
return {
1926
"url": DEFAULT_WORKER_ENV["CELERY_RESULT_BACKEND"],
2027
"host_url": DEFAULT_WORKER_ENV["CELERY_RESULT_BACKEND"],
@@ -40,6 +47,7 @@ class CeleryBackendCluster(CeleryTestCluster):
4047

4148
@classmethod
4249
def default_config(cls) -> dict:
50+
"""Default cluster configurations if not overridden by the user."""
4351
return {
4452
"urls": [DEFAULT_WORKER_ENV["CELERY_RESULT_BACKEND"]],
4553
"host_urls": [DEFAULT_WORKER_ENV["CELERY_RESULT_BACKEND"]],

src/pytest_celery/api/base.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
"""The node/cluster set are designed to provide a common interface for
2+
encapsulating the implementation of test components and their integration with
3+
the test framework.
4+
5+
This module provides the base API for creating new components by
6+
defining the base classes for nodes and clusters.
7+
"""
8+
19
from __future__ import annotations
210

311
from abc import abstractmethod

src/pytest_celery/api/broker.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
"""Broker components represents Celery's broker instances.
2+
3+
This module provides the base API for creating new broker components by
4+
defining the base classes for broker nodes and clusters.
5+
"""
6+
17
from __future__ import annotations
28

39
from pytest_celery.api.base import CeleryTestCluster
@@ -15,6 +21,7 @@ class CeleryTestBroker(CeleryTestNode):
1521

1622
@classmethod
1723
def default_config(cls) -> dict:
24+
"""Default node configurations if not overridden by the user."""
1825
return {
1926
"url": DEFAULT_WORKER_ENV["CELERY_BROKER_URL"],
2027
"host_url": DEFAULT_WORKER_ENV["CELERY_BROKER_URL"],
@@ -40,6 +47,7 @@ class CeleryBrokerCluster(CeleryTestCluster):
4047

4148
@classmethod
4249
def default_config(cls) -> dict:
50+
"""Default cluster configurations if not overridden by the user."""
4351
return {
4452
"urls": [DEFAULT_WORKER_ENV["CELERY_BROKER_URL"]],
4553
"host_urls": [DEFAULT_WORKER_ENV["CELERY_BROKER_URL"]],

src/pytest_celery/api/container.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
"""The ``pytest_docker_tools`` package powers the Docker container management
2+
for the plugin.
3+
4+
This module extends the ``Container`` class from the package to provide
5+
the base API for creating new test containers in a Celery test environment.
6+
"""
7+
18
from __future__ import annotations
29

310
from typing import Any

src/pytest_celery/api/setup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
"""The test setup represents the main entry point for accessing the celery
2+
architecture from the test.
3+
4+
This module provides the base API for creating new test setups.
5+
"""
6+
17
from __future__ import annotations
28

39
from celery import Celery

src/pytest_celery/api/worker.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
"""Worker components represents Celery's worker instances.
2+
3+
This module provides the base API for creating new worker components by
4+
defining the base classes for worker nodes and clusters.
5+
"""
6+
17
from __future__ import annotations
28

39
import json

src/pytest_celery/fixtures/backend.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
"""Every backend component is added to the test matrix using the fixtures of
2+
this module.
3+
4+
These fixtures will configure the test setup for all supported celery
5+
backends by default. Every backend will be executed as a separate test
6+
case, and the test will be executed for each supported celery backend.
7+
8+
You may override these fixtures to customize the test setup for your
9+
specific needs.
10+
"""
11+
112
# mypy: disable-error-code="misc"
213

314
from __future__ import annotations

0 commit comments

Comments
 (0)