You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/userguide/celery-bug-report.rst
+17-19Lines changed: 17 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ This guide will detail the process of creating example bug report scripts using
15
15
16
16
.. contents::
17
17
:local:
18
-
:depth:2
18
+
:depth:3
19
19
20
20
Disable Setup Matrix
21
21
====================
@@ -172,12 +172,10 @@ To install the worker from source, just run the test script from the `t/smoke/te
172
172
It will automatically set up a `dev <https://github.com/celery/celery/blob/main/t/smoke/workers/dev.py>`_ worker for the test.
173
173
174
174
Tasks and Signals
175
-
-----------------
175
+
~~~~~~~~~~~~~~~~~
176
176
177
-
The plugin provides a :func:`ping task <pytest_celery.vendors.worker.tasks.ping>` by default, but there are other
178
-
sources for tasks that can be used to reproduce a scenario.
179
-
180
-
To use the ping task, import it from the plugin.
177
+
The plugin provides :ref:`default-tasks` by default. For example, to use the :func:`ping task <pytest_celery.vendors.worker.tasks.ping>`,
178
+
import it from the plugin.
181
179
182
180
.. code-block:: python
183
181
@@ -186,7 +184,7 @@ To use the ping task, import it from the plugin.
186
184
The worker will already have it registered by default using the default worker volume.
187
185
188
186
Adding New Tasks
189
-
################
187
+
----------------
190
188
191
189
To add new tasks, create a new ``tasks.py`` module and use the :func:`default_worker_tasks <pytest_celery.vendors.worker.fixtures.default_worker_tasks>` fixture
192
190
to inject the tasks into the worker as described in the :ref:`injecting-tasks` section.
@@ -200,7 +198,7 @@ For example, the tasks module can look like this:
200
198
201
199
202
200
@shared_task
203
-
defnoop(*args, **kwargs) -> None:
201
+
defmytask(*args, **kwargs) -> None:
204
202
return celery.utils.noop(*args, **kwargs)
205
203
206
204
And then it can be injected into the worker like this:
@@ -218,17 +216,17 @@ And be used in a test like this:
0 commit comments