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.

Events listeners from all locust files being executed when running a single UserClass

See original GitHub issue

Describe the bug

When running locust with the new class-picker feature to choose the class to be executed the event listeners from all files are being executed, not just the ones inside the same file as the picked UserClass. The use case for this is being able to use @events.test_start.add_listener and @events.init.add_listener to do independent setups for each test with the new class-picker.

Thread on slack for reference

Expected behavior

I’d expect that only event listeners inside the same file of the selected UserClass get executed.

Actual behavior

Event listeners of all files are being executed.

Steps to reproduce

  1. Create two separated locustfiles (each one representing a different test)
  2. On each locustfile add @events.test_start.add_listener methods to setup anything before test run
  3. Execute the files in any of the ways below: a. By running locust with class-picker b. By running locust with multiple files and selecting the UserClass
  4. Observe the events on both files being executed on test start

Environment

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:4
  • Comments:11

github_iconTop GitHub Comments

1reaction
leonardoggallardocommented, Sep 19, 2022

Yes, I think so. Thank you for all the support 😃

0reactions
cyberwcommented, Sep 18, 2022

Can I close this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing a locustfile — Locust 2.14.0 documentation
A user class represents one type of user/scenario for your system. When you do a test run you specify the number of concurrent...
Read more >
MasterRunner target_user_count no longer set for test_start ...
Describe the bug I was following the custom_messages.py example and noticed that environment.runner.target_user_count is no longer resolving ...
Read more >
Performance and load testing with Locust - Xray Documentation
The file will have two classes, one to define the requests we want to do and another to specify the endpoint and the...
Read more >
Locust, how to access custom command line argument from ...
You can access the locust environment inside your LoadTestShape class using self.runner.environment (same as in a User/@task).
Read more >
Load Testing Using Locust.io - Medium
There is a time after our application or service is running, we want to know the performance and load that can be handled...
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