Prepare for the removal of pytest_logwarning in pytest 4.1

This commit is contained in:
Bruno Oliveira
2018-12-11 18:46:30 -02:00
parent c5d8635294
commit a30124e858

View File

@@ -115,14 +115,17 @@ class WorkerInteractor(object):
data = serialize_report(report) data = serialize_report(report)
self.sendevent("collectreport", data=data) self.sendevent("collectreport", data=data)
def pytest_logwarning(self, message, code, nodeid, fslocation): # the pytest_logwarning hook was removed in pytest 4.1
self.sendevent( if hasattr(_pytest.hookspec, "pytest_logwarning"):
"logwarning",
message=message, def pytest_logwarning(self, message, code, nodeid, fslocation):
code=code, self.sendevent(
nodeid=nodeid, "logwarning",
fslocation=str(fslocation), message=message,
) code=code,
nodeid=nodeid,
fslocation=str(fslocation),
)
# the pytest_warning_captured hook was introduced in pytest 3.8 # the pytest_warning_captured hook was introduced in pytest 3.8
if hasattr(_pytest.hookspec, "pytest_warning_captured"): if hasattr(_pytest.hookspec, "pytest_warning_captured"):