You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow -n 0 to disable xdist even if --dist is specified #231
Following the advice in #18 I'm experimenting with loadscope as a means to to pin some tests to a single subprocess. This works fine but to ensure that it works properly for developers who are going to type pytest from the command line when debugging, I need to put the --dist=loadscope into a setup.cfg file. The problem I now find is that any use of --dist mandates that -n or -tx is used:
I would be fine with this if I could add -n 0 to disable xdist completely regardless of the presence of --dist. This does not work, and gives the same error message as if no -n was used at all. If this worked then the command-line user of pytest will get the behavior they expect: no subprocess if they run pytest, correctly scoped tests if they add -n 4 to override the config file.
Is there any way that I can use a setup.cfg to use --dist=loadscope but only to activate this if a user specifies -n?
Reacted by Mattwmaster58, GalOz666, Maik Sprenger, Aristóbulo Meneses, Oliver Sanders, Ronnie Dutta, Will Da Silva, Justin Godesky and Ali Hamdan
changed the title [-]Allow `-n 0` to disable xdist even if `--dist` is specified[/-][+]Allow -n 0 to disable xdist even if --dist is specified[/+]on Sep 3, 2017
I am concerned by this issue / change request, since I can't use a debugger when pytest-xdist runs with the --dist parameter set in my setup.cfg. I would expect that -n 0 completely disables xdist.
Reacted by Oleg Nykolyn, Peter Uittenbroek, Zac Hatfield-Dodds, Chris NeJame, Adithya Balaji, Jean Saad, GalOz666, rndrr, Ivan Hanzlicek, Szymon Zmilczak and 13 more
Activity
[-]Allow `-n 0` to disable xdist even if `--dist` is specified[/-][+]Allow -n 0 to disable xdist even if --dist is specified[/+]souliane commentedon Jan 11, 2018
I am concerned by this issue / change request, since I can't use a debugger when pytest-xdist runs with the --dist parameter set in my setup.cfg. I would expect that -n 0 completely disables xdist.
kousu commentedon Jan 19, 2021
I have this in my setup.cfg:
Running
If I change it to
Then it works:
I also expected
-n 0to completely disable xdist. But that's not totally true, is it, since eg theworker_idfixture still works.MetRonnie commentedon Oct 1, 2021
If you do
pytest -n0 --dist noit seems to prevent theerror
timj commentedon Jul 12, 2023
It looks like this problem was fixed long ago. Running
pytest --dist=loadscopehandles no-njust fine.nicoddemus commentedon Jul 12, 2023
Thanks!