File tree 1 file changed +25
-16
lines changed
1 file changed +25
-16
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,8 @@ def my_task(self):
67
67
"-t" ,
68
68
"1" ,
69
69
"--headless" ,
70
+ "--host" ,
71
+ "https://test.com" ,
70
72
],
71
73
stderr = subprocess .STDOUT ,
72
74
timeout = 10 ,
@@ -126,6 +128,8 @@ def my_task(self):
126
128
"-t" ,
127
129
"1" ,
128
130
"--headless" ,
131
+ "--host" ,
132
+ "https://test.com" ,
129
133
"--skip-log-setup" ,
130
134
],
131
135
stderr = subprocess .STDOUT ,
@@ -167,6 +171,8 @@ def my_task(self):
167
171
"-t" ,
168
172
"1" ,
169
173
"--headless" ,
174
+ "--host" ,
175
+ "https://test.com" ,
170
176
"--logfile" ,
171
177
log_file_path ,
172
178
],
@@ -213,25 +219,28 @@ def test_user_broken_on_start(self):
213
219
from locust import HttpUser, task
214
220
215
221
class TestUser(HttpUser):
216
- host = "invalidhost"
217
222
218
223
def on_start(self):
219
224
self.client.get("/")
220
225
"""
221
226
)
222
227
) as file_path :
223
- output = subprocess .check_output (
224
- [
225
- "locust" ,
226
- "-f" ,
227
- file_path ,
228
- "-t" ,
229
- "1" ,
230
- "--headless" ,
231
- ],
232
- stderr = subprocess .STDOUT ,
233
- timeout = 10 ,
234
- text = True ,
235
- )
236
-
237
- self .assertIn ("ERROR/locust.user.users: Invalid URL" , output )
228
+ output = ""
229
+ try :
230
+ output = subprocess .check_output (
231
+ [
232
+ "locust" ,
233
+ "-f" ,
234
+ file_path ,
235
+ "-t" ,
236
+ "1" ,
237
+ "--headless" ,
238
+ "--host" ,
239
+ "invalidhost" ,
240
+ ],
241
+ stderr = subprocess .STDOUT ,
242
+ timeout = 10 ,
243
+ text = True ,
244
+ )
245
+ except subprocess .CalledProcessError as e :
246
+ self .assertIn ("Invalid --host option: invalidhost" , e .output )
You can’t perform that action at this time.
0 commit comments