From a30124e858322d27b31941c6ce97c8c339f21e0d Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 11 Dec 2018 18:46:30 -0200 Subject: [PATCH 1/2] Prepare for the removal of pytest_logwarning in pytest 4.1 --- xdist/remote.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) 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"): From b5c09f8e8488710bae276f4f41711613ce5053b1 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 11 Dec 2018 18:49:40 -0200 Subject: [PATCH 2/2] Add CHANGELOG --- changelog/384.bugfix.rst | 2 +- changelog/390.bugfix.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog/390.bugfix.rst 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.