File tree 2 files changed +3
-27
lines changed
2 files changed +3
-27
lines changed Original file line number Diff line number Diff line change 13
13
import sys
14
14
import time
15
15
import traceback
16
+ from urllib .parse import urlparse
16
17
17
18
import gevent
18
19
@@ -512,11 +513,7 @@ def assign_equal_weights(environment, **kwargs):
512
513
if options .equal_weights :
513
514
environment .events .init .add_listener (assign_equal_weights )
514
515
515
- if options .headless and not options .host :
516
- logger .error ("The --host option is required when running in headless mode" )
517
- sys .exit (1 )
518
-
519
- if options .host and not (options .host .startswith ("http://" ) or options .host .startswith ("https://" )):
516
+ if options .host and not (urlparse (options .host ).scheme ):
520
517
logger .error (f"Invalid --host option: { options .host } . Did you mean https://{ options .host } ?" )
521
518
sys .exit (1 )
522
519
Original file line number Diff line number Diff line change @@ -1381,28 +1381,7 @@ def my_task(self):
1381
1381
# ensure stats printer printed at least one report before shutting down and that there was a final report printed as well
1382
1382
self .assertRegex (stderr , r".*Aggregated[\S\s]*Shutting down[\S\s]*Aggregated.*" )
1383
1383
1384
- def test_headless_wo_host (self ):
1385
- with mock_locustfile () as mocked :
1386
- proc = subprocess .Popen (
1387
- [
1388
- "locust" ,
1389
- "-f" ,
1390
- mocked .file_path ,
1391
- "--run-time" ,
1392
- "1s" ,
1393
- "--headless" ,
1394
- "--loglevel" ,
1395
- "DEBUG" ,
1396
- ],
1397
- stdout = PIPE ,
1398
- stderr = PIPE ,
1399
- text = True ,
1400
- )
1401
- stdout , stderr = proc .communicate (timeout = 4 )
1402
- self .assertIn ("The --host option is required when running in headless mode" , stderr )
1403
- self .assertEqual (1 , proc .returncode )
1404
-
1405
- def test_headless_wo_protocol (self ):
1384
+ def test_host_wo_protocol (self ):
1406
1385
with mock_locustfile () as mocked :
1407
1386
proc = subprocess .Popen (
1408
1387
[
You can’t perform that action at this time.
0 commit comments