Skip test_warning_captured_deprecated_in_pytest_6 in pytest>=7.1

This commit is contained in:
Bruno Oliveira
2021-12-10 08:31:00 -03:00
parent 5f78c7155e
commit c76d5622f1
2 changed files with 9 additions and 0 deletions

View File

@@ -773,6 +773,13 @@ class TestWarnings:
"""
Do not trigger the deprecated pytest_warning_captured hook in pytest 6+ (#562)
"""
from _pytest import hookspec
if not hasattr(hookspec, "pytest_warning_captured"):
pytest.skip(
f"pytest {pytest.__version__} does not have the pytest_warning_captured hook."
)
pytester.makeconftest(
"""
def pytest_warning_captured(warning_message):