diff --git a/changelog/406.bugfix.rst b/changelog/406.bugfix.rst new file mode 100644 index 00000000..0f5e41a4 --- /dev/null +++ b/changelog/406.bugfix.rst @@ -0,0 +1 @@ +Do not implement deprecated ``pytest_logwarning`` hook in pytest versions where it is deprecated. diff --git a/xdist/remote.py b/xdist/remote.py index 1cde1355..1ea88982 100644 --- a/xdist/remote.py +++ b/xdist/remote.py @@ -115,8 +115,10 @@ def pytest_collectreport(self, report): data = serialize_report(report) self.sendevent("collectreport", data=data) - # the pytest_logwarning hook was removed in pytest 4.1 - if hasattr(_pytest.hookspec, "pytest_logwarning"): + # the pytest_logwarning hook was deprecated since pytest 4.0 + if hasattr( + _pytest.hookspec, "pytest_logwarning" + ) and not _pytest.hookspec.pytest_logwarning.pytest_spec.get("warn_on_impl"): def pytest_logwarning(self, message, code, nodeid, fslocation): self.sendevent(