Refactor locustfile.py: Import modules and reorder code
This commit is contained in:
parent
866e820ecb
commit
44696a9eb4
1 changed files with 6 additions and 5 deletions
|
|
@ -1,11 +1,12 @@
|
||||||
from locust import FastHttpUser, task, between
|
|
||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
import orjson
|
|
||||||
from rich import print
|
|
||||||
import httpx
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
import orjson
|
||||||
|
from locust import FastHttpUser, between, task
|
||||||
|
from rich import print
|
||||||
|
|
||||||
|
|
||||||
class NameTest(FastHttpUser):
|
class NameTest(FastHttpUser):
|
||||||
wait_time = between(1, 5)
|
wait_time = between(1, 5)
|
||||||
|
|
@ -13,7 +14,7 @@ class NameTest(FastHttpUser):
|
||||||
with open("names.txt", "r") as file:
|
with open("names.txt", "r") as file:
|
||||||
names = [line.strip() for line in file.readlines()]
|
names = [line.strip() for line in file.readlines()]
|
||||||
|
|
||||||
headers = {}
|
headers: dict = {}
|
||||||
|
|
||||||
def poll_task(self, task_id, sleep_time=1):
|
def poll_task(self, task_id, sleep_time=1):
|
||||||
while True:
|
while True:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue