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

Option to Skip Monkey Patching with LOCUST_SKIP_MONKEY_PATCH #2765

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions docs/use-as-lib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ to view the stats, and to control the runner (e.g. start and stop load tests):
env.create_web_ui()
env.web_ui.greenlet.join()

Skipping monkey patching
========================

Some packages such as boto3 may have incompatibility when using Locust as a library, where monkey patching is already applied. In this case monkey patching may be disabled by setting ``LOCUST_SKIP_MONKEY_PATCH=1`` as env variable.

Full example
============

Expand Down
3 changes: 2 additions & 1 deletion locust/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

from gevent import monkey

monkey.patch_all()
if not os.getenv("LOCUST_SKIP_MONKEY_PATCH", None):
monkey.patch_all()

from ._version import version as __version__
from .contrib.fasthttp import FastHttpUser
Expand Down
Loading