diff --git a/changelog/384.bugfix.rst b/changelog/384.bugfix.rst index 2ea011e..0dd2f03 100644 --- a/changelog/384.bugfix.rst +++ b/changelog/384.bugfix.rst @@ -1 +1 @@ -Add support for pytest 4.1. +pytest 4.1 support: ``ExceptionInfo`` API changes. diff --git a/changelog/390.bugfix.rst b/changelog/390.bugfix.rst new file mode 100644 index 0000000..a4ea70f --- /dev/null +++ b/changelog/390.bugfix.rst @@ -0,0 +1 @@ +pytest 4.1 support: ``pytest_logwarning`` hook removed. diff --git a/xdist/remote.py b/xdist/remote.py index a0afa49..615a88c 100644 --- a/xdist/remote.py +++ b/xdist/remote.py @@ -115,14 +115,17 @@ class WorkerInteractor(object): data = serialize_report(report) self.sendevent("collectreport", data=data) - def pytest_logwarning(self, message, code, nodeid, fslocation): - self.sendevent( - "logwarning", - message=message, - code=code, - nodeid=nodeid, - fslocation=str(fslocation), - ) + # the pytest_logwarning hook was removed in pytest 4.1 + if hasattr(_pytest.hookspec, "pytest_logwarning"): + + def pytest_logwarning(self, message, code, nodeid, fslocation): + self.sendevent( + "logwarning", + message=message, + code=code, + nodeid=nodeid, + fslocation=str(fslocation), + ) # the pytest_warning_captured hook was introduced in pytest 3.8 if hasattr(_pytest.hookspec, "pytest_warning_captured"):