Skip to content

Don't break --failed-first when re-ordering tests #820

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

Merged
merged 1 commit into from
Feb 28, 2020

Conversation

callahad
Copy link
Contributor

Pytest-django 3.5.0 attempts to run tests in the same order as Django:
Issue #223, Commit 5a79fba

Pytest itself can re-order tests to prioritize previously failed tests
(--failed-first), incremental runs of the test suite (--stepwise), etc.
However, pytest-django's re-ordering clobbers pytest's, which can break
those options as reported in #819.

By applying the @pytest.hookimpl(tryfirst=True) decorator to
pytest_collection_modifyitems(), pytest-django's re-ordering happens
first, and does not clobber the later re-ordering performed by pytest.

Fixes #819

Pytest-django 3.5.0 attempts to run tests in the same order as Django:
Issue pytest-dev#223, Commit 5a79fba

Pytest itself can re-order tests to prioritize previously failed tests
(--failed-first), incremental runs of the test suite (--stepwise), etc.
However, pytest-django's re-ordering clobbers pytest's, which can break
those options as reported in pytest-dev#819.

By applying the @pytest.hookimpl(tryfirst=True) decorator to
pytest_collection_modifyitems(), pytest-django's re-ordering happens
first, and does not clobber the later re-ordering performed by pytest.

Fixes pytest-dev#819
@blueyed
Copy link
Contributor

blueyed commented Feb 28, 2020

Thanks!

A fix for pytest also makes sense additionally: blueyed/pytest#262

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

Successfully merging this pull request may close these issues.

Test re-ordering breaks Pytest's --failed-first and --stepwise options
2 participants