Skip to content

Commit 33d5441

Browse files
authored
Merge pull request #390 from nicoddemus/pytest-logwarning
Prepare for the removal of pytest_logwarning in pytest 4.1
2 parents c5d8635 + b5c09f8 commit 33d5441

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

changelog/384.bugfix.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Add support for pytest 4.1.
1+
pytest 4.1 support: ``ExceptionInfo`` API changes.

changelog/390.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pytest 4.1 support: ``pytest_logwarning`` hook removed.

xdist/remote.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,17 @@ def pytest_collectreport(self, report):
115115
data = serialize_report(report)
116116
self.sendevent("collectreport", data=data)
117117

118-
def pytest_logwarning(self, message, code, nodeid, fslocation):
119-
self.sendevent(
120-
"logwarning",
121-
message=message,
122-
code=code,
123-
nodeid=nodeid,
124-
fslocation=str(fslocation),
125-
)
118+
# the pytest_logwarning hook was removed in pytest 4.1
119+
if hasattr(_pytest.hookspec, "pytest_logwarning"):
120+
121+
def pytest_logwarning(self, message, code, nodeid, fslocation):
122+
self.sendevent(
123+
"logwarning",
124+
message=message,
125+
code=code,
126+
nodeid=nodeid,
127+
fslocation=str(fslocation),
128+
)
126129

127130
# the pytest_warning_captured hook was introduced in pytest 3.8
128131
if hasattr(_pytest.hookspec, "pytest_warning_captured"):

0 commit comments

Comments
 (0)