Do not implement pytest_logwarning in pytest versions where it is deprecated

Fix #406
This commit is contained in:
Bruno Oliveira
2019-01-28 18:05:41 -02:00
parent f00f9ecf58
commit c5f65b39ec
2 changed files with 5 additions and 2 deletions

1
changelog/406.bugfix.rst Normal file
View File

@@ -0,0 +1 @@
Do not implement deprecated ``pytest_logwarning`` hook in pytest versions where it is deprecated.

View File

@@ -115,8 +115,10 @@ class WorkerInteractor(object):
data = serialize_report(report) data = serialize_report(report)
self.sendevent("collectreport", data=data) self.sendevent("collectreport", data=data)
# the pytest_logwarning hook was removed in pytest 4.1 # the pytest_logwarning hook was deprecated since pytest 4.0
if hasattr(_pytest.hookspec, "pytest_logwarning"): 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): def pytest_logwarning(self, message, code, nodeid, fslocation):
self.sendevent( self.sendevent(