Skip to content

Commit d22eb1b

Browse files
committed
Update logging tests
1 parent f8d46a9 commit d22eb1b

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

Diff for: locust/test/test_log.py

+25-16
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ def my_task(self):
6767
"-t",
6868
"1",
6969
"--headless",
70+
"--host",
71+
"https://test.com",
7072
],
7173
stderr=subprocess.STDOUT,
7274
timeout=10,
@@ -126,6 +128,8 @@ def my_task(self):
126128
"-t",
127129
"1",
128130
"--headless",
131+
"--host",
132+
"https://test.com",
129133
"--skip-log-setup",
130134
],
131135
stderr=subprocess.STDOUT,
@@ -167,6 +171,8 @@ def my_task(self):
167171
"-t",
168172
"1",
169173
"--headless",
174+
"--host",
175+
"https://test.com",
170176
"--logfile",
171177
log_file_path,
172178
],
@@ -213,25 +219,28 @@ def test_user_broken_on_start(self):
213219
from locust import HttpUser, task
214220
215221
class TestUser(HttpUser):
216-
host = "invalidhost"
217222
218223
def on_start(self):
219224
self.client.get("/")
220225
"""
221226
)
222227
) 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)

0 commit comments

Comments
 (0)