Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed some spelling/grammar on docstrings in core.py #1323

Merged
merged 1 commit into from
Apr 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions locust/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def my_task()
class NoClientWarningRaiser(object):
"""
The purpose of this class is to emit a sensible error message for old test scripts that
inherits from Locust, and expects there to be an HTTP client under the client attribute.
inherit from Locust, and expects there to be an HTTP client under the client attribute.
"""
def __getattr__(self, _):
raise LocustError("No client instantiated. Did you intend to inherit from HttpLocust?")
Expand All @@ -70,7 +70,7 @@ def __getattr__(self, _):
def get_tasks_from_base_classes(bases, class_dict):
"""
Function used by both TaskSetMeta and LocustMeta for collecting all declared tasks
on the TaskSet/Locust class and all it's base classes
on the TaskSet/Locust class and all its base classes
"""
new_tasks = []
for base in bases:
Expand Down Expand Up @@ -114,14 +114,14 @@ class TaskSet(object, metaclass=TaskSetMeta):
Class defining a set of tasks that a Locust user will execute.

When a TaskSet starts running, it will pick a task from the *tasks* attribute,
execute it, and then sleep for the number of seconds returned by it's *wait_time*
execute it, and then sleep for the number of seconds returned by its *wait_time*
function. If no wait_time method has been declared on the TaskSet, it'll call the
wait_time function on the Locust by default. It will then schedule another task
for execution and so on.

TaskSets can be nested, which means that a TaskSet's *tasks* attribute can contain
another TaskSet. If the nested TaskSet it scheduled to be executed, it will be
instantiated and called from the current executing TaskSet. Execution in the
another TaskSet. If the nested TaskSet is scheduled to be executed, it will be
instantiated and called from the currently executing TaskSet. Execution in the
currently running TaskSet will then be handed over to the nested TaskSet which will
continue to run until it throws an InterruptTaskSet exception, which is done when
:py:meth:`TaskSet.interrupt() <locust.core.TaskSet.interrupt>` is called. (execution
Expand All @@ -134,9 +134,9 @@ class TaskSet(object, metaclass=TaskSetMeta):

If tasks is a list, the task to be performed will be picked randomly.

If tasks is a *(callable,int)* list of two-tuples, or a {callable:int} dict,
If tasks is a *(callable,int)* list of two-tuples, or a {callable:int} dict,
the task to be performed will be picked randomly, but each task will be weighted
according to it's corresponding int value. So in the following case *ThreadPage* will
according to its corresponding int value. So in the following case, *ThreadPage* will
be fifteen times more likely to be picked than *write_post*::

class ForumPage(TaskSet):
Expand Down Expand Up @@ -208,7 +208,7 @@ def on_start(self):

def on_stop(self):
"""
Called when a Locust user stops executing this TaskSet. E.g. when Taskset.interrupt() is called
Called when a Locust user stops executing this TaskSet. E.g. when TaskSet.interrupt() is called
or when the user is killed
"""
pass
Expand Down Expand Up @@ -278,8 +278,8 @@ def schedule_task(self, task_callable, args=None, kwargs=None, first=False):

*Arguments*:

* task_callable: Locust task to schedule
* args: Arguments that will be passed to the task callable
* task_callable: Locust task to schedule.
* args: Arguments that will be passed to the task callable.
* kwargs: Dict of keyword arguments that will be passed to the task callable.
* first: Optional keyword argument. If True, the task will be put first in the queue.
"""
Expand Down Expand Up @@ -319,8 +319,8 @@ def wait(self):
Make the running locust user sleep for a duration defined by the Locust.wait_time
function (or TaskSet.wait_time function if it's been defined).

The user can also be killed gracefully while it's sleeping so calling this
method within a task makes it possible for a user to be killed mid-task even if you've
The user can also be killed gracefully while it's sleeping, so calling this
method within a task makes it possible for a user to be killed mid-task, even if you've
set a stop_timeout. If this behavour is not desired you should make the user wait using
gevent.sleep() instead.
"""
Expand All @@ -342,10 +342,10 @@ def interrupt(self, reschedule=True):
Interrupt the TaskSet and hand over execution control back to the parent TaskSet.

If *reschedule* is True (default), the parent Locust will immediately re-schedule,
and execute, a new task
and execute, a new task.

This method should not be called by the root TaskSet (the one that is immediately,
attached to the Locust class' *task_set* attribute), but rather in nested TaskSet
attached to the Locust class's *task_set* attribute), but rather in nested TaskSet
classes further down the hierarchy.
"""
raise InterruptTaskSet(reschedule)
Expand Down Expand Up @@ -400,8 +400,8 @@ class Locust(object, metaclass=LocustMeta):
"""
Represents a "user" which is to be hatched and attack the system that is to be load tested.

The behaviour of this user is defined by it's tasks. Tasks can be declared either directly on the
class by using the :py:func:`@task decorator <locust.core.task>` on the methods, or by setting
The behaviour of this user is defined by its tasks. Tasks can be declared either directly on the
class by using the :py:func:`@task decorator <locust.core.task>` on methods, or by setting
the :py:attr:`tasks attribute <locust.core.Locust.tasks>`.

This class should usually be subclassed by a class that defines some kind of client. For
Expand Down Expand Up @@ -445,20 +445,20 @@ class User(Locust):

If tasks is a list, the task to be performed will be picked randomly.

If tasks is a *(callable,int)* list of two-tuples, or a {callable:int} dict,
If tasks is a *(callable,int)* list of two-tuples, or a {callable:int} dict,
the task to be performed will be picked randomly, but each task will be weighted
according to it's corresponding int value. So in the following case *ThreadPage* will
according to its corresponding int value. So in the following case, *ThreadPage* will
be fifteen times more likely to be picked than *write_post*::

class ForumPage(TaskSet):
tasks = {ThreadPage:15, write_post:1}
"""

weight = 10
"""Probability of locust being chosen. The higher the weight, the greater is the chance of it being chosen."""
"""Probability of locust being chosen. The higher the weight, the greater the chance of it being chosen."""

abstract = True
"""If abstract is True it the class is meant to be subclassed (users of this class itself will not be spawned during a test)"""
"""If abstract is True, the class is meant to be subclassed, and users will not choose this locust during a test"""

client = NoClientWarningRaiser()
_state = None
Expand Down Expand Up @@ -500,9 +500,9 @@ def wait(self):
Make the running locust user sleep for a duration defined by the Locust.wait_time
function.

The user can also be killed gracefully while it's sleeping so calling this
The user can also be killed gracefully while it's sleeping, so calling this
method within a task makes it possible for a user to be killed mid-task even if you've
set a stop_timeout. If this behavour is not desired you should make the user wait using
set a stop_timeout. If this behavour is not desired, you should make the user wait using
gevent.sleep() instead.
"""
self._taskset_instance.wait()
Expand All @@ -520,7 +520,7 @@ def start(self, gevent_group):
def run_locust(user):
"""
Main function for Locust user greenlet. It's important that this function takes the locust
instance as argument, since we use greenlet_instance.args[0] to retrieve a reference to the
instance as an argument, since we use greenlet_instance.args[0] to retrieve a reference to the
locust instance.
"""
user.run()
Expand All @@ -530,7 +530,7 @@ def run_locust(user):
def stop(self, gevent_group, force=False):
"""
Stop the locust user greenlet that exists in the gevent_group.
This method is not meant to be called from within of the Locust's greenlet.
This method is not meant to be called from within the Locust's greenlet.

*Arguments*:

Expand All @@ -553,21 +553,21 @@ class HttpLocust(Locust):
"""
Represents an HTTP "user" which is to be hatched and attack the system that is to be load tested.

The behaviour of this user is defined by it's tasks. Tasks can be declared either directly on the
class by using the :py:func:`@task decorator <locust.core.task>` on the methods, or by setting
The behaviour of this user is defined by its tasks. Tasks can be declared either directly on the
class by using the :py:func:`@task decorator <locust.core.task>` on methods, or by setting
the :py:attr:`tasks attribute <locust.core.Locust.tasks>`.

This class creates a *client* attribute on instantiation which is an HTTP client with support
for keeping a user session between requests.
"""

abstract = True
"""If abstract is True it the class is meant to be subclassed (users of this class itself will not be spawned during a test)"""
"""If abstract is True, the class is meant to be subclassed, and users will not choose this locust during a test"""

client = None
"""
Instance of HttpSession that is created upon instantiation of Locust.
The client support cookies, and therefore keeps the session between HTTP requests.
The client supports cookies, and therefore keeps the session between HTTP requests.
"""

def __init__(self, *args, **kwargs):
Expand Down