Switch to new-style pluggy hook wrappers

Fix #11122.
This commit is contained in:
Ran Benita
2023-06-12 22:30:06 +03:00
parent 7008385253
commit b41acaea12
34 changed files with 334 additions and 275 deletions

View File

@@ -1,6 +1,7 @@
import dataclasses
import re
import sys
from typing import Generator
from typing import List
import pytest
@@ -21,11 +22,11 @@ if sys.gettrace():
sys.settrace(orig_trace)
@pytest.hookimpl(hookwrapper=True, tryfirst=True)
def pytest_collection_modifyitems(items):
@pytest.hookimpl(wrapper=True, tryfirst=True)
def pytest_collection_modifyitems(items) -> Generator[None, None, None]:
"""Prefer faster tests.
Use a hookwrapper to do this in the beginning, so e.g. --ff still works
Use a hook wrapper to do this in the beginning, so e.g. --ff still works
correctly.
"""
fast_items = []
@@ -62,7 +63,7 @@ def pytest_collection_modifyitems(items):
items[:] = fast_items + neutral_items + slow_items + slowest_items
yield
return (yield)
@pytest.fixture