question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Class picker incorrectly populates Parsed Options

See original GitHub issue

Describe the bug

When using the Web UI’s class picker, Parsed Options are incorrectly populated

Expected behavior

Each name of a picked class is available as a single item in the environment.parsed_options.user_classes list Example when selecting the class “PurchaseUser”: image

Actual behavior

When choosing classes through class picker, the name of the class is broken into characters. Each character is present as its own item in the environment.parsed_options.user_classes list. Example when selecting the class “PurchaseUser”: image

Steps to reproduce

  • Start locust with the --class-picker option and without specifying a user class through the CLI
  • Select a class from the class picker menu and start the test
  • Access the environment.parsed_options.user_classes list in the test_start listener
@events.test_start.add_listener
def on_test_start(environment, **__):
    user_classes = environment.parsed_options.user_classes
    log.info(user_classes)

Environment

  • OS: MacOS Big Sur (11.4)
  • Python version: 3.7.9
  • Locust version: 2.12.0
  • Locust command line that you ran: locust --class-picker
  • Locust file contents (anonymized if necessary):
import logging
import time
from locust import HttpUser, task, between, events

log = logging.getLogger(__name__)

@events.test_start.add_listener
def on_test_start(environment, **_):
    user_classes = environment.parsed_options.user_classes
    log.info(user_classes)

class PurchaseUser(HttpUser):
    wait_time = between(1, 5)

    @task
    def hello_world(self):
        self.client.get("/hello")
        self.client.get("/world")

    @task(3)
    def view_items(self):
        for item_id in range(10):
            self.client.get(f"/item?id={item_id}", name="/item")
            time.sleep(1)

    def on_start(self):
        self.client.post("/login", json={"username":"foo", "password":"bar"})

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
mikenestercommented, Sep 11, 2022

I think this is happening when /swarm updates environment.parsed_options. I’ll try to get a fix in today or tomorrow

1reaction
cyberwcommented, Sep 13, 2022

@Vino4 's comment makes sense to me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Material DatePicker parses incorrectly if user write date in input
In my angular 4 project I am using some matDatepicker, It works correctly if I select a date from datepicker but if I...
Read more >
optparse — Parser for command line options — Python 3.11.1 ...
A list of Option objects to populate the parser with. The options in option_list are added after any options in standard_option_list (a class...
Read more >
Populate a Select Dropdown List using JSON - Code by Amir
In this article, we'll walk through code that populates a dropdown ... Target the dropdown; Clear any existing options; Insert a default ...
Read more >
<input type="datetime-local"> - HTML - MDN Web Docs
The problem is with the client side of things: parsing of dates with more than 4 digits in the year.
Read more >
Problems — CVXPY 1.2 documentation
The Problem class is the entry point to specifying and solving optimization ... backward() populates the gradient attribute of each Parameter in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found