From f75f7c192586fd856dad10673cd6d1f8cce03f75 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 19 Apr 2019 01:23:08 +0200 Subject: [PATCH] conftest: use a hookwrapper with sorting faster tests first --- testing/conftest.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/testing/conftest.py b/testing/conftest.py index fb677cd05..4582c7d90 100644 --- a/testing/conftest.py +++ b/testing/conftest.py @@ -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