Skip to content

Commit

Permalink
Import trio before gevent patching if LOCUST_PLAYWRIGHT is set. For s…
Browse files Browse the repository at this point in the history
…upporting locust-plugins's Playwright User.
  • Loading branch information
cyberw committed Feb 6, 2022
1 parent b14464c commit aedc3b9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions locust/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
import os

if os.getenv("LOCUST_PLAYWRIGHT", False):
# This is a hack to make Playwright testing possible. If trio is not imported before gevent's monkey patching,
# it raises "NotImplementedError: unsupported platform"
# Playwright is used by PlaywrightUser, see https://github.com/SvenskaSpel/locust-plugins/blob/master/examples/playwright_ex.py
import trio

from gevent import monkey

monkey.patch_all()
Expand Down

0 comments on commit aedc3b9

Please sign in to comment.