diff --git a/docs/use-as-lib.rst b/docs/use-as-lib.rst index 21630cb0b4..3747af274e 100644 --- a/docs/use-as-lib.rst +++ b/docs/use-as-lib.rst @@ -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 ============ diff --git a/locust/__init__.py b/locust/__init__.py index 3e752e7b7b..57f3f91cc8 100644 --- a/locust/__init__.py +++ b/locust/__init__.py @@ -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