pytest-dev / pytest-dev/pytest-xdist
Unexpected error message when `--dist worksteal`, `-n0` and `--pdb` flags are all set.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 287
- Avg merge
- 9h 30m
- Merged PRs (30d)
- 2
Description
Pytest shows an unexpected error message with the following flags:
$ py.test -n0 --pdb --dist worksteal
ERROR: --pdb is incompatible with distributing tests; try using -n0 or -nauto.
This is an issue for me since I have a pytest.ini set up like so:
[pytest]
addopts =
-n auto --dist worksteal
This allows me to have it so that the default pytest run without parameters runs all of the test in parallel mode in the most efficient way.
But quite often I run just one test file and when doing so I would like for pytest to not use the parallel mode so I add the -n0 flag. This works as expected. I can also run pytest with just the --pdb flag, this automatically disables the parallelism as well.
But when I have both the --pdb and -n0 flags I get the error.
Everything works as expected when --dist worksteal is not there in the pytest.ini file but that can make the full parallel test suite run slower than it needs to be.
This is a big issue for me since I often run tests on single test file many times over and I alternate between running it with pdb and without. It would be much more convininent and faster if I could just add and remove the --pdb flag instead of alternating between the --pdb and -n0 flags.
Also I think the error message describes the issue poorly since I already have the -n0 flag on that is suggested by it.
Thanks
Pytest version:
py.test --version
pytest 7.4.3
Operating system version:
macOS 13.6.1 (22G313)
- a detailed description of the bug or problem you are having
- output of
pip listfrom the virtual environment you are using - pytest and operating system versions
- minimal example if possible
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the command py.test -n0 --pdb --dist worksteal using the issue's pytest.ini configuration and compare it with runs using each flag separately. Trace the pytest command-line handling for --pdb, -n0, and --dist worksteal; done means the combined flags no longer produce the misleading incompatibility error and existing distributed-test behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100