Refactor locustfile.py: Import modules and reorder code

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-01-30 16:16:38 -03:00
commit 44696a9eb4

View file

@ -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: