Skip to content

Commit f75f7c1

Browse files
committed
conftest: use a hookwrapper with sorting faster tests first
1 parent 1460ad6 commit f75f7c1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

testing/conftest.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1+
import pytest
2+
3+
4+
@pytest.hookimpl(hookwrapper=True, tryfirst=True)
15
def pytest_collection_modifyitems(config, items):
2-
"""Prefer faster tests."""
6+
"""Prefer faster tests.
7+
8+
Use a hookwrapper to do this in the beginning, so e.g. --ff still works
9+
correctly.
10+
"""
311
fast_items = []
412
slow_items = []
513
neutral_items = []
@@ -24,3 +32,5 @@ def pytest_collection_modifyitems(config, items):
2432
fast_items.append(item)
2533

2634
items[:] = fast_items + neutral_items + slow_items
35+
36+
yield

0 commit comments

Comments
 (0)