def pytest_collection_modifyitems(config, items):
    """Prefer faster tests."""
    fast_items = []
    slow_items = []
    neutral_items = []

    slow_fixturenames = ("testdir",)

    for item in items:
        try:
            fixtures = item.fixturenames
        except AttributeError:
            # doctest at least
            # (https://github.com/pytest-dev/pytest/issues/5070)
            neutral_items.append(item)
        else:
            if any(x for x in fixtures if x in slow_fixturenames):
                slow_items.append(item)
            else:
                marker = item.get_closest_marker("slow")
                if marker:
                    slow_items.append(item)
                else:
                    fast_items.append(item)

    items[:] = fast_items + neutral_items + slow_items

@@ -1,8 +1,74 @@
+import pytest%0A%0A%0A@pytest.hookimpl(hookwrapper=True, tryfirst=True)%0A
 def pyte
@@ -136,16 +136,113 @@
 r tests.
+%0A%0A    Use a hookwrapper to do this in the beginning, so e.g. --ff still works%0A    correctly.%0A    
 %22%22%22%0A    
@@ -971,8 +971,19 @@
 w_items%0A
+%0A    yield%0A

use a hookwrapper with sorting faster tests first