From 4d6805fc18e0ba56dd18260a29bac9cfb1de3f96 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Sun, 31 Jul 2022 19:21:45 +0200 Subject: [PATCH] migrate tryfirst mark to hookimpl compat --- src/pytest_cov/compat.py | 2 ++ src/pytest_cov/plugin.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pytest_cov/compat.py b/src/pytest_cov/compat.py index f422f25c..3681e88c 100644 --- a/src/pytest_cov/compat.py +++ b/src/pytest_cov/compat.py @@ -10,8 +10,10 @@ if hasattr(pytest, 'hookimpl'): hookwrapper = pytest.hookimpl(hookwrapper=True) + tryfirst = pytest.hookimpl(tryfirst=True) else: hookwrapper = pytest.mark.hookwrapper + tryfirst = pytest.mark.tryfirst class SessionWrapper: diff --git a/src/pytest_cov/plugin.py b/src/pytest_cov/plugin.py index 252439ed..e50e5f44 100644 --- a/src/pytest_cov/plugin.py +++ b/src/pytest_cov/plugin.py @@ -133,7 +133,7 @@ def _prepare_cov_source(cov_source): return None if True in cov_source else [path for path in cov_source if path is not True] -@pytest.mark.tryfirst +@compat.tryfirst def pytest_load_initial_conftests(early_config, parser, args): options = early_config.known_args_namespace no_cov = options.no_cov_should_warn = False