-
Notifications
You must be signed in to change notification settings - Fork 234
Missing mechanism to extend the --dist choices when adding a new scheduler results in pytest execution failure #970
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Hi @vitaly-krugl, Indeed this is a problem that we overlooked. From the top of my head I don't know how we could solve this, TBH. |
We could consider a entry point |
I ended up working around this limitation as follows:
NOTE: I needed to pass my plugin via both the
|
@nicoddemus and @RonnyPfannschmidt, the workaround that I documented in my previous comment isn't necessarily a substitute for a well-documented and supported scheduler plugin mechanism. However, it demonstrates a relatively-clean (I think) working prototype for bootstrapping an add-on xdist scheduler into xdist and into the pytest command-line. It also suggests that an add-on scheduler may have a need to set its own specific options via pytest command line. |
Maybe there should be a hook that returns a list of available schedulers (or a name => callable (factory) dictionary)? |
Yeah that's an idea, however it does not work currently on how options are added currently: |
Definitely, unfortunately (at least to me) there is no clear way forward yet on how to support this nicely. |
Hi @nicoddemus, here is a proposal that I think could work: Presently, when xdist's plugin.pytest_configure would finds the default "no" in config.option.dist, it bypasses distributed execution altogether (wouldn't create DSession, etc.).
|
There seems to be no way to fix the argument validation, at least without complicating things unnecessarily. So simply remove it. Instead, check `pytest_xdist_make_scheduler` return value. Also, convert every builtin scheduler to a separate plugin. Fixes: pytest-dev#970
Documentation says to use
pytest_xdist_make_scheduler
to add a new scheduler. However, command line parsing fails because the choices for the--dist
command line option are fixed byxdist.plugin.pytest_addoption
. Also, help string that documents each of the available options in--dist
is not extensible to include the new scheduler choices.The text was updated successfully, but these errors were encountered: