Merge pull request #5145 from blueyed/prefer-fast-wrapper

conftest: use a hookwrapper with sorting faster tests first
This commit is contained in:
Bruno Oliveira 2019-04-19 12:25:55 -03:00 committed by GitHub
commit 322d686ab4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,13 @@
import pytest
@pytest.hookimpl(hookwrapper=True, tryfirst=True)
def pytest_collection_modifyitems(config, items):
"""Prefer faster tests."""
"""Prefer faster tests.
Use a hookwrapper to do this in the beginning, so e.g. --ff still works
correctly.
"""
fast_items = []
slow_items = []
neutral_items = []
@ -24,3 +32,5 @@ def pytest_collection_modifyitems(config, items):
fast_items.append(item)
items[:] = fast_items + neutral_items + slow_items
yield