Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for the removal of pytest_logwarning in pytest 4.1 #390

Merged
merged 2 commits into from
Dec 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion changelog/384.bugfix.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Add support for pytest 4.1.
pytest 4.1 support: ``ExceptionInfo`` API changes.
1 change: 1 addition & 0 deletions changelog/390.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest 4.1 support: ``pytest_logwarning`` hook removed.
19 changes: 11 additions & 8 deletions xdist/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,17 @@ def pytest_collectreport(self, report):
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"):
Expand Down