Support new `pytest_warning_recorded` hook from pytest 6.0

This commit is contained in:
Bruno Oliveira
2020-07-08 17:51:45 -03:00
parent 77a1db27cd
commit b25757199c
3 changed files with 31 additions and 1 deletions

View File

@@ -277,10 +277,17 @@ class DSession(object):
self.config.hook.pytest_logwarning.call_historic(kwargs=kwargs)
def worker_warning_captured(self, warning_message, when, item):
"""Emitted when a node calls the pytest_logwarning hook."""
"""Emitted when a node calls the pytest_warning_captured hook (deprecated in 6.0)."""
kwargs = dict(warning_message=warning_message, when=when, item=item)
self.config.hook.pytest_warning_captured.call_historic(kwargs=kwargs)
def worker_warning_recorded(self, warning_message, when, nodeid, location):
"""Emitted when a node calls the pytest_warning_recorded hook."""
kwargs = dict(
warning_message=warning_message, when=when, nodeid=nodeid, location=location
)
self.config.hook.pytest_warning_recorded.call_historic(kwargs=kwargs)
def _clone_node(self, node):
"""Return new node based on an existing one.