diff --git a/docs/writing-a-locustfile.rst b/docs/writing-a-locustfile.rst index 8540a398d6..a3f5864488 100644 --- a/docs/writing-a-locustfile.rst +++ b/docs/writing-a-locustfile.rst @@ -211,7 +211,7 @@ and then Python's ``random.choice()`` is used pick tasks from the list. Tagging tasks ------------- -By tagging tasks using the `tag ` decorator, you can be picky about what tasks are +By tagging tasks using the :py:func:`@tag ` decorator, you can be picky about what tasks are executed during the test using the :code:`--tags` and :code:`--exclude-tags` arguments. Consider the following example: @@ -377,8 +377,8 @@ parent TaskSet instance. Tags and TaskSets ------------------ -You can tag TaskSets using the `tag ` decorator in a similar way to normal tasks, as -described `above `, but there are some nuances worth mentioning. Tagging a TaskSet +You can tag TaskSets using the :py:func:`@tag ` decorator in a similar way to normal tasks, as +described :ref:`above `, but there are some nuances worth mentioning. Tagging a TaskSet will automatically apply the tag(s) to all of the TaskSet's tasks. Furthermore, if you tag a task within a nested TaskSet, locust will execute that task even if the TaskSet isn't tagged. diff --git a/locust/user/task.py b/locust/user/task.py index 507d85592f..4ccdcea483 100644 --- a/locust/user/task.py +++ b/locust/user/task.py @@ -55,9 +55,9 @@ def my_task() def tag(*tags): """ - Decorator for tagging tasks and TaskSets with the given tag name. You can then limit the test - to only execute tasks that are tagged with any of the tags provided by the --tags command-line - argument. Example:: + Decorator for tagging tasks and TaskSets with the given tag name. You can + then limit the test to only execute tasks that are tagged with any of the + tags provided by the :code:`--tags` command-line argument. Example:: class ForumPage(TaskSet): @tag('thread')