conftest: use a hookwrapper with sorting faster tests first

This commit is contained in:
Daniel Hahler 2019-04-19 01:23:08 +02:00
parent 1460ad6027
commit f75f7c1925
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