locust 2.23.1.dev7__py3-none-any.whl → 2.23.2.dev7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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.23.1.dev7'
16
- __version_tuple__ = version_tuple = (2, 23, 1, 'dev7')
15
+ __version__ = version = '2.23.2.dev7'
16
+ __version_tuple__ = version_tuple = (2, 23, 2, 'dev7')
locust/argument_parser.py CHANGED
@@ -4,6 +4,7 @@ import locust
4
4
  from locust import runners
5
5
  from locust.rpc import Message, zmqrpc
6
6
 
7
+ import ast
7
8
  import atexit
8
9
  import os
9
10
  import platform
@@ -159,13 +160,19 @@ def is_url(url: str) -> bool:
159
160
  def download_locustfile_from_url(url: str) -> str:
160
161
  try:
161
162
  response = requests.get(url)
163
+ # Check if response is valid python code
164
+ ast.parse(response.text)
162
165
  except requests.exceptions.RequestException as e:
163
166
  sys.stderr.write(f"Failed to get locustfile from: {url}. Exception: {e}")
164
167
  sys.exit(1)
168
+ except SyntaxError:
169
+ sys.stderr.write(f"Failed to get locustfile from: {url}. Response is not valid python code.")
170
+ sys.exit(1)
165
171
 
166
172
  with open(os.path.join(tempfile.gettempdir(), url.rsplit("/", 1)[-1]), "w") as locustfile:
167
173
  locustfile.write(response.text)
168
174
 
175
+ # Clean up downloaded files on exit
169
176
  def exit_handler():
170
177
  try:
171
178
  os.remove(locustfile.name)
@@ -202,7 +209,7 @@ See documentation for more details, including how to set options using a file or
202
209
  "--locustfile",
203
210
  metavar="<filename>",
204
211
  default="locustfile",
205
- help="The Python file or module that contains your test, e.g. 'my_test.py'. Also accepts multiple comma-separated .py files or a package name/directory. Defaults to 'locustfile'.",
212
+ help="The Python file or module that contains your test, e.g. 'my_test.py'. Accepts multiple comma-separated .py files, a package name/directory or a url to a remote locustfile. Defaults to 'locustfile'.",
206
213
  env_var="LOCUST_LOCUSTFILE",
207
214
  )
208
215
 
locust/main.py CHANGED
@@ -132,6 +132,10 @@ def main():
132
132
  logging.error("stats.PERCENTILES_TO_CHART parameter should be 2 parameters \n")
133
133
  sys.exit(1)
134
134
 
135
+ if len(stats.MODERN_UI_PERCENTILES_TO_CHART) > 6:
136
+ logging.error("stats.MODERN_UI_PERCENTILES_TO_CHART parameter should be a maximum of 6 parameters \n")
137
+ sys.exit(1)
138
+
135
139
  def is_valid_percentile(parameter):
136
140
  try:
137
141
  if 0 < float(parameter) < 1: