@@ -286,7 +286,6 @@ def my_task(self):
286
286
)
287
287
) as file_path :
288
288
proc = subprocess .Popen (["locust" , "-f" , file_path , "--autostart" ], stdout = PIPE , stderr = PIPE , text = True )
289
- gevent .sleep (1 )
290
289
stdout , stderr = proc .communicate ()
291
290
self .assertIn ("parameter need to be float and value between. 0 < percentile < 1 Eg 0.95" , stderr )
292
291
self .assertEqual (1 , proc .returncode )
@@ -617,7 +616,7 @@ def test_autostart_wo_run_time(self):
617
616
try :
618
617
response = requests .get (f"http://localhost:{ port } /" )
619
618
except Exception :
620
- pass
619
+ response = None
621
620
proc .send_signal (signal .SIGTERM )
622
621
stdout , stderr = proc .communicate ()
623
622
self .assertIn ("Starting Locust" , stderr )
@@ -656,7 +655,7 @@ def test_autostart_w_run_time(self):
656
655
try :
657
656
response = requests .get (f"http://localhost:{ port } /" )
658
657
except Exception :
659
- pass
658
+ response = None
660
659
_ , stderr = proc .communicate (timeout = 4 )
661
660
self .assertIn ("Starting Locust" , stderr )
662
661
self .assertIn ("Run time limit set to 3 seconds" , stderr )
@@ -814,6 +813,7 @@ def my_task(self):
814
813
response = requests .get (f"http://localhost:{ port } /" )
815
814
except ConnectionError :
816
815
success = False
816
+ response = None
817
817
try :
818
818
_ , stderr = proc .communicate (timeout = 5 )
819
819
except subprocess .TimeoutExpired :
@@ -916,7 +916,6 @@ def t(self):
916
916
917
917
# This should not do anything since we are already at zero users
918
918
stdin .write (b"S" )
919
- gevent .sleep (1 )
920
919
921
920
output = proc .communicate ()[0 ]
922
921
stdin .close ()
@@ -1287,7 +1286,6 @@ def my_task(self):
1287
1286
with temporary_file (content = MOCK_LOCUSTFILE_CONTENT_A ) as file1 :
1288
1287
with temporary_file (content = MOCK_LOCUSTFILE_CONTENT_C ) as file2 :
1289
1288
proc = subprocess .Popen (["locust" , "-f" , f"{ file1 } ,{ file2 } " ], stdout = PIPE , stderr = PIPE , text = True )
1290
- gevent .sleep (1 )
1291
1289
stdout , stderr = proc .communicate ()
1292
1290
1293
1291
self .assertIn ("Duplicate user class names: TestUser1 is defined" , stderr )
@@ -1305,7 +1303,6 @@ def test_no_error_when_same_userclass_in_two_files(self):
1305
1303
proc = subprocess .Popen (
1306
1304
["locust" , "-f" , f"{ file1 } ,{ file2 } " , "-t" , "1" , "--headless" ], stdout = PIPE , stderr = PIPE , text = True
1307
1305
)
1308
- gevent .sleep (1 )
1309
1306
stdout , stderr = proc .communicate ()
1310
1307
1311
1308
self .assertIn ("running my_task" , stdout )
@@ -1339,7 +1336,6 @@ def tick(self):
1339
1336
with temporary_file (content = MOCK_LOCUSTFILE_CONTENT_C ) as file1 :
1340
1337
with temporary_file (content = MOCK_LOCUSTFILE_CONTENT_D ) as file2 :
1341
1338
proc = subprocess .Popen (["locust" , "-f" , f"{ file1 } ,{ file2 } " ], stdout = PIPE , stderr = PIPE , text = True )
1342
- gevent .sleep (1 )
1343
1339
stdout , stderr = proc .communicate ()
1344
1340
1345
1341
self .assertIn ("Duplicate shape classes: TestShape" , stderr )
@@ -1428,7 +1424,6 @@ def tick(self):
1428
1424
def test_error_when_locustfiles_directory_is_empty (self ):
1429
1425
with TemporaryDirectory () as temp_dir :
1430
1426
proc = subprocess .Popen (["locust" , "-f" , temp_dir ], stdout = PIPE , stderr = PIPE , text = True )
1431
- gevent .sleep (1 )
1432
1427
stdout , stderr = proc .communicate ()
1433
1428
1434
1429
self .assertIn (f"Could not find any locustfiles in directory '{ temp_dir } '" , stderr )
0 commit comments