Skip to content

Commit c5f65b3

Browse files
committed
Do not implement pytest_logwarning in pytest versions where it is deprecated
Fix #406
1 parent f00f9ec commit c5f65b3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

changelog/406.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Do not implement deprecated ``pytest_logwarning`` hook in pytest versions where it is deprecated.

xdist/remote.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,10 @@ def pytest_collectreport(self, report):
115115
data = serialize_report(report)
116116
self.sendevent("collectreport", data=data)
117117

118-
# the pytest_logwarning hook was removed in pytest 4.1
119-
if hasattr(_pytest.hookspec, "pytest_logwarning"):
118+
# the pytest_logwarning hook was deprecated since pytest 4.0
119+
if hasattr(
120+
_pytest.hookspec, "pytest_logwarning"
121+
) and not _pytest.hookspec.pytest_logwarning.pytest_spec.get("warn_on_impl"):
120122

121123
def pytest_logwarning(self, message, code, nodeid, fslocation):
122124
self.sendevent(

0 commit comments

Comments
 (0)