Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Locust class found #621

Closed
alok-nag opened this issue Jul 11, 2017 · 16 comments
Closed

No Locust class found #621

alok-nag opened this issue Jul 11, 2017 · 16 comments

Comments

@alok-nag
Copy link

  • 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.

@alok-nag
Copy link
Author

Can someone please help?

@aldenpeterson-wf
Copy link
Contributor

what is your locust file?

@alok-nag
Copy link
Author

alok-nag commented Jul 12, 2017

`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
`

@aldenpeterson-wf
Copy link
Contributor

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

@alok-nag
Copy link
Author

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.

@cgoldberg
Copy link
Member

@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.

@elfarqy
Copy link

elfarqy commented Sep 5, 2017

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

@uduse
Copy link

uduse commented Mar 1, 2018

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

@mrserzhan
Copy link

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

@megaman3
Copy link

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.

@mishalalex
Copy link

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!

@StefanoGITA
Copy link

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!

@heyman
Copy link
Member

heyman commented May 20, 2020

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

@StefanoGITA
Copy link

StefanoGITA commented May 20, 2020 via email

@heyman
Copy link
Member

heyman commented May 22, 2020

@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

@StefanoGITA
Copy link

StefanoGITA commented Jun 18, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants