Locust: No Locust class found

Created on 11 Jul 2017  ·  16Comments  ·  Source: locustio/locust

  • I installed locustio and wrote a simple locustfile.py to check min_rate/max_rate as given in docs.
  • I am using virtualenv and locust --help command works fine and print help.
  • locust -V prints Locust 0.7..5

When I start locust using locust -f locustfile.py -H http://docs.locust.io
I get error saying: No Locust class found!

_Python version is 2.7.12, running on Ubuntu VM._

Please let me know what needs to be done.

needs reproducing

Most helpful comment

i think locust is reserved keyword for locust file. I try to renaming my test locust file to other, and locust can running.

All 16 comments

Can someone please help?

what is your locust file?

`from locust import Locust, TaskSet, task

class MyTaskSet(TaskSet):
@task
def my_task(self):
print "Executing my task"

class MyLocust(Locust):
task_set = MyTaskSet
min_wait = 5000
max_wait= 50000
`

I am able to run that fine locally after fixing indentation, can you give more context for why it's not working?

$cat locustfile.py
from locust import Locust, TaskSet, task

class MyTaskSet(TaskSet):
  @task
  def my_task(self):
      print "Executing my task"

class MyLocust(Locust):
  task_set = MyTaskSet
  min_wait = 5000
  max_wait= 50000

This is all I know of.
This file saved as locustfile.py
Python 2.7.12, running in virtualenv on Ubuntu VM.
from virtualenv I run command "locust -f locustfile.py -H http://docs.locust.io" and I get that error after it prints some warnings about using zmq
/ERROR/locust.main: No Locust class found!

What else can I collect - am quite new to this. Evaluating to see if I can use it for my testing of a webapp.

@alok-nag
you closed this issue right after your comment requesting help. If you are still experiencing this and believe it is a real issue with Locust, please re-open (or else nobody will look at it). I will leave it closed until then.

i think locust is reserved keyword for locust file. I try to renaming my test locust file to other, and locust can running.

@elfarqy yep yep. I renamed my file from locust.py to query_locust.py and resolved the problem.

I have the same issue, but in my case python file was the same as directory name. Idk why, but renaming helps

I got this error when copy example from guide in to text editor and save as py file. When white space and tab are mixed this error were shown.

I am getting the same error when I tried to run locust on windows. I have corrected the white space and indentation. Still when I tried to execute the command - locust - I am getting the same error
No Locust class found!

Hi I've the same error on Win10.
I use virtualenv and in test1.py there is the "With HTML parsing" in https://locust.io/:
(venv) C:\Users\sgiostra\PycharmProjects\stress_test>locust -f test1.py
and i got:
[2020-05-19 23:17:53,357] BB-168/ERROR/locust.main: No Locust class found!

@StefanoGITA
The examples on https://locust.io hadn't been properly updated after the release of locust 1.0. It has now been fixed!

I'm on windows and I use locust (pipy locustio) 0.14.6
The example https://docs.locust.io/en/stable/quickstart.htmlon
documentation is different and don't show where put the url of the site.

Where can I find an example like that on home for locust 0.14.6?

Thanks.

Stefano G.

Il giorno mer 20 mag 2020 alle ore 10:28 Jonatan Heyman <
[email protected]> ha scritto:

@StefanoGITA https://github.com/StefanoGITA
The examples on https://locust.io hadn't been properly updated after the
release of locust 1.0. It has now been fixed!


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/locustio/locust/issues/621#issuecomment-631323460,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AF4B4H3UM5SGRQWPJYB5KB3RSOIDPANCNFSM4DSRUQEQ
.

@StefanoGITA
You can read the docs for 0.14.6 here: https://docs.locust.io/en/0.14.6/index.html

The examples on https://locust.io has been updated for the latest stable version (1.0.1), and the old examples there are gone. Maybe you can find the old examples using WaybackMachine on https://archive.org

Hi Jonatan
now wit 1.0.3 i can use locust on windows too.
Wonderful tool, I really appreciate your work.

Stefano G.

Il giorno ven 22 mag 2020 alle ore 17:50 Jonatan Heyman <
[email protected]> ha scritto:

@StefanoGITA https://github.com/StefanoGITA
You can read the docs for 0.14.6 here:
https://docs.locust.io/en/0.14.6/index.html

The examples on https://locust.io has been updated for the latest stable
version (1.0.1), and the old examples there are gone. Maybe you can find
the old examples using WaybackMachine on https://archive.org


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/locustio/locust/issues/621#issuecomment-632764605,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AF4B4H5UMZM2PJCTPW4K4ADRS2NNTANCNFSM4DSRUQEQ
.

Was this page helpful?
0 / 5 - 0 ratings