No Locust class found!
See original GitHub issueDescribe the bug
Cannot run simple locust example
Expected behavior
The test should run - not sure what to expect since I’ve never seen a successful example
Actual behavior
I received the error:
[2020-04-09 14:52:59,330] sami/ERROR/locust.main: No Locust class found!
Steps to reproduce
-
Install virtualenv && activate virtualenv venv --python python3 source venv/bin/activate
-
Install locust
pip3 install locust
-
Create a locustfile called “locustfile.py” with content
import random
from locust import HttpLocust, task, between
class WebsiteUser(HttpLocust):
wait_time = between(5, 9)
@task(1)
def index(self):
self.client.get("/")
- Run it and see error:
> locust --host=https://google.com --locustfile locustfile.py
[2020-04-09 14:56:22,097] sami/ERROR/locust.main: No Locust class found!
Environment
- OS: 18.04.4 LTS
- Python version: Python 3.7.3
- Locust version: locust 0.14.5
- Locust command line that you ran: locust --host=https://google.com --locustfile locustfile.py
- Locust file contents (anonymized if necessary):
import random
from locust import HttpLocust, task, between
class WebsiteUser(HttpLocust):
wait_time = between(5, 9)
@task(1)
def index(self):
self.client.get("/")
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
No Locust class found when running locustfile - Stack Overflow
The error message should actually have read "No Locust class with tasks found!". Just uncomment your task and it will be found correctly....
Read more >ERROR/locust.main: No User class found! #1620 - GitHub
Not able to run even the basic example it just fails. $ sudo docker run -p 8089:8089 -v $PWD:/mnt/locust locustio/locust --version
Read more >Writing a locustfile — Locust 0.6 documentation
A locust class represents one user (or a swarming locust if you will). ... a host attribute in the locust class, it will...
Read more >locustio/locust - Gitter
locustio/locust ... although I was not running in distributed mode... this is the command that I executed: locust -f locustfile.py --no-web -c 1...
Read more >Locust + Python Examples: Variables + Assertions - BlazeMeter
from locust import HttpUser, task class User(HttpUser): @task def mainPage(self): ... If we run the test we can see that it has no...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
yes you are right - thanks for the clarification
For anyone else reading this, please look at the following reference code that works for locust 0.14.5
Oh, nice catch! I have actually been wondering why so many people have referred to the
/latest/
docs instead of/stable/
when we’ve set stable as default in Readthedocs. Now I have the answer 😃.Fixed now!