locust 2.32.11.dev9__py3-none-any.whl → 2.32.11.dev13__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- locust/_version.py +2 -2
- locust/argument_parser.py +4 -1
- locust/html.py +19 -0
- locust/main.py +2 -1
- locust/webui/dist/assets/{index-DnScW665.js → index-Bcn8JR9P.js} +55 -55
- locust/webui/dist/auth.html +1 -1
- locust/webui/dist/index.html +1 -1
- locust/webui/dist/report.html +55 -55
- {locust-2.32.11.dev9.dist-info → locust-2.32.11.dev13.dist-info}/METADATA +1 -1
- {locust-2.32.11.dev9.dist-info → locust-2.32.11.dev13.dist-info}/RECORD +13 -13
- {locust-2.32.11.dev9.dist-info → locust-2.32.11.dev13.dist-info}/WHEEL +0 -0
- {locust-2.32.11.dev9.dist-info → locust-2.32.11.dev13.dist-info}/entry_points.txt +0 -0
- {locust-2.32.11.dev9.dist-info → locust-2.32.11.dev13.dist-info}/licenses/LICENSE +0 -0
locust/_version.py
CHANGED
@@ -12,5 +12,5 @@ __version__: str
|
|
12
12
|
__version_tuple__: VERSION_TUPLE
|
13
13
|
version_tuple: VERSION_TUPLE
|
14
14
|
|
15
|
-
__version__ = version = '2.32.11.
|
16
|
-
__version_tuple__ = version_tuple = (2, 32, 11, '
|
15
|
+
__version__ = version = '2.32.11.dev13'
|
16
|
+
__version_tuple__ = version_tuple = (2, 32, 11, 'dev13')
|
locust/argument_parser.py
CHANGED
@@ -208,6 +208,9 @@ Usage: locust [options] [UserClass ...]
|
|
208
208
|
|
209
209
|
locust --headless -u 100 -t 20m --processes 4 MyHttpUser AnotherUser
|
210
210
|
|
211
|
+
locust --headless -u 100 -r 10 -t 50 --print-stats --html "test_report_{u}_{r}_{t}.html" -H https://www.example.com
|
212
|
+
(The above run would generate an html file with the name "test_report_100_10_50.html")
|
213
|
+
|
211
214
|
See documentation for more details, including how to set options using a file or environment variables: https://docs.locust.io/en/stable/configuration.html""",
|
212
215
|
)
|
213
216
|
parser.add_argument(
|
@@ -754,7 +757,7 @@ Typically ONLY these options (and --locustfile) need to be specified on workers,
|
|
754
757
|
"--html",
|
755
758
|
metavar="<filename>",
|
756
759
|
dest="html_file",
|
757
|
-
help="Store HTML report to file path specified",
|
760
|
+
help="Store HTML report to file path specified. Able to parse certain tags - {u}, {r}, {t} and convert them to number of users, spawn rate and run time respectively.",
|
758
761
|
env_var="LOCUST_HTML",
|
759
762
|
)
|
760
763
|
stats_group.add_argument(
|
locust/html.py
CHANGED
@@ -15,6 +15,25 @@ PERCENTILES_FOR_HTML_REPORT = [0.50, 0.6, 0.7, 0.8, 0.9, 0.95, 0.99, 1.0]
|
|
15
15
|
DEFAULT_BUILD_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "webui", "dist")
|
16
16
|
|
17
17
|
|
18
|
+
def process_html_filename(options) -> None:
|
19
|
+
num_users = options.num_users
|
20
|
+
spawn_rate = options.spawn_rate
|
21
|
+
run_time = options.run_time
|
22
|
+
|
23
|
+
option_mapping = {
|
24
|
+
"{u}": num_users,
|
25
|
+
"{r}": spawn_rate,
|
26
|
+
"{t}": run_time,
|
27
|
+
}
|
28
|
+
|
29
|
+
html_filename = options.html_file
|
30
|
+
|
31
|
+
for option_term, option_value in option_mapping.items():
|
32
|
+
html_filename = html_filename.replace(option_term, str(int(option_value)))
|
33
|
+
|
34
|
+
options.html_file = html_filename
|
35
|
+
|
36
|
+
|
18
37
|
def render_template_from(file, build_path=DEFAULT_BUILD_PATH, **kwargs):
|
19
38
|
env = JinjaEnvironment(loader=FileSystemLoader(build_path))
|
20
39
|
template = env.get_template(file)
|
locust/main.py
CHANGED
@@ -20,7 +20,7 @@ import gevent
|
|
20
20
|
from . import log, stats
|
21
21
|
from .argument_parser import parse_locustfile_option, parse_options
|
22
22
|
from .env import Environment
|
23
|
-
from .html import get_html_report
|
23
|
+
from .html import get_html_report, process_html_filename
|
24
24
|
from .input_events import input_listener
|
25
25
|
from .log import greenlet_exception_logger, setup_logging
|
26
26
|
from .stats import (
|
@@ -651,6 +651,7 @@ See https://github.com/locustio/locust/wiki/Installation#increasing-maximum-numb
|
|
651
651
|
|
652
652
|
def save_html_report():
|
653
653
|
html_report = get_html_report(environment, show_download_link=False)
|
654
|
+
process_html_filename(options)
|
654
655
|
logger.info("writing html report to file: %s", options.html_file)
|
655
656
|
with open(options.html_file, "w", encoding="utf-8") as file:
|
656
657
|
file.write(html_report)
|