Skip to content

Commit 46c9a56

Browse files
committed
bump min locust-cloud version to latest
1 parent acc8280 commit 46c9a56

File tree

7 files changed

+12
-80
lines changed

7 files changed

+12
-80
lines changed

locust/argument_parser.py

-6
Original file line numberDiff line numberDiff line change
@@ -773,12 +773,6 @@ def setup_parser_arguments(parser):
773773
action="store_true",
774774
help="Prints the final stats in JSON format to stdout. Useful for parsing the results in other programs/scripts. Use together with --headless and --skip-log for an output only with the json data.",
775775
)
776-
stats_group.add_argument(
777-
"--json-file",
778-
metavar="<filename>",
779-
dest="json_file",
780-
help="Prints the final stats in JSON format to file path specified.",
781-
)
782776

783777
log_group = parser.add_argument_group("Logging options")
784778
log_group.add_argument(

locust/input_events.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,8 @@ def input_listener(key_to_func_map: dict[str, Callable]):
9999
def input_listener_func():
100100
try:
101101
poller = get_poller()
102-
except InitError:
103-
# This is a bit chatty, even for debug. Uncomment it if you're having problems with keyboard events
104-
# logging.debug(e)
102+
except InitError as e:
103+
logging.debug(e)
105104
return
106105

107106
try:

locust/main.py

-2
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,6 @@ def shutdown():
640640
runner.quit()
641641
if options.json:
642642
stats.print_stats_json(runner.stats)
643-
if options.json_file:
644-
stats.save_stats_json(runner.stats, options.json_file)
645643
elif not isinstance(runner, locust.runners.WorkerRunner):
646644
stats.print_stats(runner.stats, current=False)
647645
stats.print_percentile_stats(runner.stats)

locust/stats.py

-5
Original file line numberDiff line numberDiff line change
@@ -820,11 +820,6 @@ def print_stats_json(stats: RequestStats) -> None:
820820
print(json.dumps(stats.serialize_stats(), indent=4))
821821

822822

823-
def save_stats_json(stats: RequestStats, filename: str) -> None:
824-
with open(f"{filename}.json", "w") as file:
825-
json.dump(stats.serialize_stats(), file, indent=4)
826-
827-
828823
def get_stats_summary(stats: RequestStats, current=True) -> list[str]:
829824
"""
830825
stats summary will be returned as list of string

locust/test/test_main.py

-48
Original file line numberDiff line numberDiff line change
@@ -2067,54 +2067,6 @@ def hello_world(self):
20672067
self.assertEqual(dict, type(result["num_reqs_per_sec"]))
20682068
self.assertEqual(dict, type(result["num_fail_per_sec"]))
20692069

2070-
def test_json_file(self):
2071-
LOCUSTFILE_CONTENT = textwrap.dedent(
2072-
"""
2073-
from locust import HttpUser, task, constant
2074-
2075-
class QuickstartUser(HttpUser):
2076-
wait_time = constant(1)
2077-
2078-
@task
2079-
def hello_world(self):
2080-
self.client.get("/")
2081-
2082-
"""
2083-
)
2084-
output_base = "locust_output"
2085-
output_filepath = f"{output_base}.json"
2086-
if os.path.exists(output_filepath):
2087-
os.remove(output_filepath)
2088-
with mock_locustfile(content=LOCUSTFILE_CONTENT) as mocked:
2089-
proc = subprocess.Popen(
2090-
[
2091-
"locust",
2092-
"-f",
2093-
mocked.file_path,
2094-
"--host",
2095-
"http://google.com",
2096-
"--headless",
2097-
"-u",
2098-
"1",
2099-
"-t",
2100-
"2s",
2101-
"--json-file",
2102-
output_base,
2103-
],
2104-
stderr=PIPE,
2105-
stdout=PIPE,
2106-
text=True,
2107-
)
2108-
stdout, stderr = proc.communicate()
2109-
self.assertNotIn("error: argument --json-file: expected one argument", stderr)
2110-
self.assertTrue(os.path.exists(output_filepath))
2111-
with open(output_filepath, encoding="utf-8") as file:
2112-
[stats] = json.load(file)
2113-
self.assertEqual(stats["name"], "/")
2114-
2115-
if os.path.exists(output_filepath):
2116-
os.remove(output_filepath)
2117-
21182070
@unittest.skipIf(True, reason="This test is too slow for the value it provides")
21192071
def test_worker_indexes(self):
21202072
content = """

locust/webui/src/components/SwarmForm/tests/SwarmForm.test.tsx

+6-12
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ import { camelCaseKeys, queryStringToObject, toTitleCase } from 'utils/string';
1111

1212
const startSwarm = vi.fn();
1313

14-
const getStartSwarmMockCall = () => {
15-
const mockCalls = startSwarm.mock.calls[0];
16-
17-
return mockCalls && mockCalls[0];
18-
};
19-
2014
const server = setupServer(
2115
http.post(`${TEST_BASE_API}/swarm`, async ({ request }) =>
2216
startSwarm(camelCaseKeys(queryStringToObject(await request.text()))),
@@ -39,7 +33,7 @@ describe('SwarmForm', () => {
3933
});
4034

4135
await waitFor(async () => {
42-
const submittedData = getStartSwarmMockCall();
36+
const submittedData = startSwarm.mock.calls[0][0];
4337

4438
if (submittedData) {
4539
expect(submittedData).toEqual({
@@ -85,7 +79,7 @@ describe('SwarmForm', () => {
8579
});
8680

8781
await waitFor(async () => {
88-
const submittedData = getStartSwarmMockCall();
82+
const submittedData = startSwarm.mock.calls[0][0];
8983

9084
if (submittedData) {
9185
expect(submittedData).toEqual({
@@ -133,7 +127,7 @@ describe('SwarmForm', () => {
133127
});
134128

135129
await waitFor(async () => {
136-
const submittedData = getStartSwarmMockCall();
130+
const submittedData = startSwarm.mock.calls[0][0];
137131

138132
if (submittedData) {
139133
expect(submittedData).toEqual({
@@ -181,7 +175,7 @@ describe('SwarmForm', () => {
181175
});
182176

183177
await waitFor(() => {
184-
const submittedData = getStartSwarmMockCall();
178+
const submittedData = startSwarm.mock.calls[0][0];
185179

186180
if (submittedData) {
187181
expect(submittedData).toEqual({
@@ -239,7 +233,7 @@ describe('SwarmForm', () => {
239233
});
240234

241235
await waitFor(async () => {
242-
const submittedData = getStartSwarmMockCall();
236+
const submittedData = startSwarm.mock.calls[0][0];
243237

244238
if (submittedData) {
245239
expect(submittedData).toEqual({
@@ -268,7 +262,7 @@ describe('SwarmForm', () => {
268262
});
269263

270264
await waitFor(async () => {
271-
const submittedData = getStartSwarmMockCall();
265+
const submittedData = startSwarm.mock.calls[0][0];
272266

273267
if (submittedData) {
274268
expect(submittedData).toEqual({

uv.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)