Add config parameter to pytest_report_teststatus hook

This commit is contained in:
Bruno Oliveira 2019-01-28 19:00:50 -02:00
parent 9905a73ae0
commit 5b09eb1d74
3 changed files with 7 additions and 3 deletions

View File

@ -481,9 +481,11 @@ def pytest_report_collectionfinish(config, startdir, items):
@hookspec(firstresult=True)
def pytest_report_teststatus(report):
def pytest_report_teststatus(report, config):
""" return result-category, shortletter and verbose word for reporting.
:param _pytest.config.Config config: pytest config object
Stops at first non-None result, see :ref:`firstresult` """

View File

@ -66,7 +66,9 @@ class ResultLog(object):
def pytest_runtest_logreport(self, report):
if report.when != "call" and report.passed:
return
res = self.config.hook.pytest_report_teststatus(report=report)
res = self.config.hook.pytest_report_teststatus(
report=report, config=self.config
)
code = res[1]
if code == "x":
longrepr = str(report.longrepr)

View File

@ -363,7 +363,7 @@ class TerminalReporter(object):
def pytest_runtest_logreport(self, report):
rep = report
res = self.config.hook.pytest_report_teststatus(report=rep)
res = self.config.hook.pytest_report_teststatus(report=rep, config=self.config)
category, letter, word = res
if isinstance(word, tuple):
word, markup = word