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

Prohibits the locustfile from being named 'locust.py' #546

Merged
merged 1 commit into from
Feb 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions locust/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,15 @@ def main():
sys.exit(0)

locustfile = find_locustfile(options.locustfile)

if not locustfile:
logger.error("Could not find any locustfile! Ensure file ends in '.py' and see --help for available options.")
sys.exit(1)

if locustfile == "locust.py":
logger.error("The locustfile must not be named `locust.py`. Please rename the file and try again.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error message could be more helpful with: Did you mean locustfile.py?

Copy link
Member Author

@cgoldberg cgoldberg Feb 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justiniso thanks!
however, the file can be named something else when you use the -f option. do you think your message implies it must be named locustfile.py?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I mean if someone is naming their file locust.py, seems like they don't have many locustfiles and are just looking for whatever "default" name works, in which case locustfile.py suits that need. But I guess it can be misinterpreted. Let's leave it then.

sys.exit(1)

docstring, locusts = load_locustfile(locustfile)

if options.list_commands:
Expand Down