Skip to content

Commit

Permalink
Issue locustio#1832 Displaying locustfile and tasks ratio information…
Browse files Browse the repository at this point in the history
… on index.html
  • Loading branch information
tyge68 committed Aug 31, 2021
1 parent 0508140 commit 8ca5787
Show file tree
Hide file tree
Showing 13 changed files with 529 additions and 362 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ docs/_build/**
docs/cli-help-output.txt
docs/config-options.rst
mock.*.egg
web_test_*.csv
.eggs/
dist/**
.idea/**
*.iml
Expand Down
2 changes: 2 additions & 0 deletions locust/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def __init__(
user_classes=None,
shape_class=None,
tags=None,
locustfile=None,
exclude_tags=None,
events=None,
host=None,
Expand All @@ -93,6 +94,7 @@ def __init__(
else:
self.events = Events()

self.locustfile = locustfile
self.user_classes = user_classes or []
self.shape_class = shape_class
self.tags = tags
Expand Down
8 changes: 6 additions & 2 deletions locust/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ def load_locustfile(path):
return imported.__doc__, user_classes, shape_class


def create_environment(user_classes, options, events=None, shape_class=None):
def create_environment(user_classes, options, events=None, shape_class=None, locustfile=None):
"""
Create an Environment instance from options
"""
return Environment(
locustfile=locustfile,
user_classes=user_classes,
shape_class=shape_class,
tags=options.tags,
Expand Down Expand Up @@ -204,7 +205,9 @@ def main():
)

# create locust Environment
environment = create_environment(user_classes, options, events=locust.events, shape_class=shape_class)
environment = create_environment(
user_classes, options, events=locust.events, shape_class=shape_class, locustfile=os.path.basename(locustfile)
)

if shape_class and (options.num_users or options.spawn_rate):
logger.warning(
Expand Down Expand Up @@ -476,6 +479,7 @@ def timelimit_stop():
else:
logger.info("No run time limit set, use CTRL+C to interrupt")

logger.info(f"user_classes {environment.user_classes}")
main_greenlet.join()
if options.html_file:
html_report = get_html_report(environment, show_download_link=False)
Expand Down
Loading

0 comments on commit 8ca5787

Please sign in to comment.