Skip to content

Commit c76d562

Browse files
committed
Skip test_warning_captured_deprecated_in_pytest_6 in pytest>=7.1
1 parent 5f78c71 commit c76d562

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/xdist/dsession.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ def worker_collectreport(self, node, rep):
294294

295295
def worker_warning_captured(self, warning_message, when, item):
296296
"""Emitted when a node calls the pytest_warning_captured hook (deprecated in 6.0)."""
297+
# This hook as been removed in pytest 7.1, and we can remove support once we only
298+
# support pytest >=7.1.
297299
kwargs = dict(warning_message=warning_message, when=when, item=item)
298300
self.config.hook.pytest_warning_captured.call_historic(kwargs=kwargs)
299301

testing/acceptance_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,13 @@ def test_warning_captured_deprecated_in_pytest_6(
773773
"""
774774
Do not trigger the deprecated pytest_warning_captured hook in pytest 6+ (#562)
775775
"""
776+
from _pytest import hookspec
777+
778+
if not hasattr(hookspec, "pytest_warning_captured"):
779+
pytest.skip(
780+
f"pytest {pytest.__version__} does not have the pytest_warning_captured hook."
781+
)
782+
776783
pytester.makeconftest(
777784
"""
778785
def pytest_warning_captured(warning_message):

0 commit comments

Comments
 (0)