pytest-dev / pytest-dev/pytest-xdist
last failed is not honored when collection error occurs
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 287
- Avg merge
- 9h 30m
- Merged PRs (30d)
- 2
Description
Steps to reproduce
- create a folder names tests
- create a file
test_foo.pywith the contentdef test_1(): assert True - create a file
test_bar.pywith the content
import pytest
@pytest.skip("reason")
def test_2():
assert False
- Execute
pytest tests/ -n2 -vv - Execute
pytest tests/ -n2 --lf -vv --last-failed-no-failures none
As you can see in the logs test_bar cannot be collected due to a collection error. However in the second run also test_foo is exeuted again which is not expected. When pytest is executed w/o pytest-xdist the execution fails directly bc of the collection error. If the collection error is removed (still assert False will lead to an error), the behavior is as expected.
I use the latest pytest, pytest-xdist version and python 3.12.1
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
Start by reproducing the issue with the two pytest commands and the provided test files. Trace how pytest-xdist handles collection errors together with --lf and --last-failed-no-failures; done means the second run does not execute test_foo when test_bar has a collection error, while behavior remains correct after removing that error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- distributed-systems, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100