Open fstamour opened 4 weeks ago
Yea this is a real bug. I think your suggested fix sounds reasonable and would love for you to PR it!
@fstamour is anyone working this ? , would like to have a crack at it
I would like to work on this if there's any chance..? @cyberw
Go for it. I meant to assign it to you.
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