Skip to content

Commit

Permalink
Skip monkey patching with env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbaldwin44 committed Jun 20, 2024
1 parent 1fc3143 commit 40cbd7a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
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

0 comments on commit 40cbd7a

Please sign in to comment.