Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

last failed is not honored when collection error occurs #1087

Open
kasium opened this issue May 23, 2024 · 0 comments
Open

last failed is not honored when collection error occurs #1087

kasium opened this issue May 23, 2024 · 0 comments

Comments

@kasium
Copy link

kasium commented May 23, 2024

Steps to reproduce

  1. create a folder names tests
  2. create a file test_foo.py with the content def test_1(): assert True
  3. create a file test_bar.py with the content
import pytest
@pytest.skip("reason")
def test_2():
    assert False
  1. Execute pytest tests/ -n2 -vv
  2. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant