We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
locust --help
(I'm not certain you would consider this a bug or a feature request.)
locust.conf
locust -f locustfile.py
locust
locustfile.py
init_command_line_parser
Replace the built-in help action by something that loads the locustfile before printing the help.
--help
parser.add_argument('-h', '--help', action="store_true" ...
args.help == True
parser.print_help()
parser.exit()
_HelpAction
import argparse from locust import events print("top-level") @events.init_command_line_parser.add_listener def init_command_line_parser(parser: argparse.ArgumentParser): """ Initialize the command line parser with custom arguments. """ print("init_command_line_parser") parser.add_argument( "--my-little-argument", type=str, help="Choose a custom load shape", choices=["a", "b", "c"], )
Test with both Python 3.10.12 and 3.12.6
2.31.6
Ubuntu 22.04.4 LTS and 24.04 LTS
The text was updated successfully, but these errors were encountered:
Yea this is a real bug. I think your suggested fix sounds reasonable and would love for you to PR it!
Sorry, something went wrong.
@fstamour is anyone working this ? , would like to have a crack at it
fstamour
No branches or pull requests
Prerequisites
Description
(I'm not certain you would consider this a bug or a feature request.)
How to reproduce
locust.conf
file in the current directorylocust --help
(or evenlocust -f locustfile.py
)Expected result
locust
to load thelocustfile.py
and run theinit_command_line_parser
hooklocust --help
's outputActual result
locustfile.py
is not loaded at all when runninglocust --help
.locust --help
's output.Possible fix
Replace the built-in help action by something that loads the locustfile before printing the help.
--help
argument (parser.add_argument('-h', '--help', action="store_true" ...
)args.help == True
parser.print_help()
andparser.exit()
(just like the default_HelpAction
does)Command line
locust --help
Locustfile contents
Python version
Test with both Python 3.10.12 and 3.12.6
Locust version
2.31.6
Operating system
Ubuntu 22.04.4 LTS and 24.04 LTS
The text was updated successfully, but these errors were encountered: