Skip to content

Commit

Permalink
Delay importing locust-plugins to prevent circular import.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberw committed Aug 5, 2023
1 parent 5e67d05 commit 8efc77c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 0 additions & 6 deletions locust/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@
from .debug import run_single_user
from .event import Events

try:
# import locust_plugins if it is installed, to allow it to register custom arguments etc
import locust_plugins # pyright: ignore[reportMissingImports]
except ModuleNotFoundError:
pass

events = Events()

__all__ = (
Expand Down
6 changes: 6 additions & 0 deletions locust/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ def create_environment(


def main():
try:
# import locust_plugins if it is installed, to allow it to register custom arguments etc
import locust_plugins # pyright: ignore[reportMissingImports]
except ModuleNotFoundError:
pass

# find specified locustfile(s) and make sure it exists, using a very simplified
# command line parser that is only used to parse the -f option.
locustfiles = parse_locustfile_option()
Expand Down

0 comments on commit 8efc77c

Please sign in to comment.