parent
afc8e6bd91
commit
cea46a86aa
|
@ -7,6 +7,8 @@ Changes between 1.0.0 and 1.0.1
|
||||||
|
|
||||||
* terser reporting of collection error tracebacks, now skips py-internals
|
* terser reporting of collection error tracebacks, now skips py-internals
|
||||||
|
|
||||||
|
* renaming of arguments to some special rather internal hooks
|
||||||
|
|
||||||
Changes between 1.0.0b9 and 1.0.0
|
Changes between 1.0.0b9 and 1.0.0
|
||||||
=====================================
|
=====================================
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ def pytest__teardown_final(session):
|
||||||
""" called before test session finishes. """
|
""" called before test session finishes. """
|
||||||
pytest__teardown_final.firstresult = True
|
pytest__teardown_final.firstresult = True
|
||||||
|
|
||||||
def pytest__teardown_final_logerror(rep):
|
def pytest__teardown_final_logerror(report):
|
||||||
""" called if runtest_teardown_final failed. """
|
""" called if runtest_teardown_final failed. """
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
@ -108,8 +108,8 @@ def pytest_sessionfinish(session, exitstatus):
|
||||||
# hooks for influencing reporting (invoked from pytest_terminal)
|
# hooks for influencing reporting (invoked from pytest_terminal)
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
|
||||||
def pytest_report_teststatus(rep):
|
def pytest_report_teststatus(report):
|
||||||
""" return shortletter and verbose word. """
|
""" return result-category, shortletter and verbose word for reporting."""
|
||||||
pytest_report_teststatus.firstresult = True
|
pytest_report_teststatus.firstresult = True
|
||||||
|
|
||||||
def pytest_terminal_summary(terminalreporter):
|
def pytest_terminal_summary(terminalreporter):
|
||||||
|
|
|
@ -24,7 +24,7 @@ def pytest_sessionfinish(session, exitstatus):
|
||||||
hook = session.config.hook
|
hook = session.config.hook
|
||||||
rep = hook.pytest__teardown_final(session=session)
|
rep = hook.pytest__teardown_final(session=session)
|
||||||
if rep:
|
if rep:
|
||||||
hook.pytest__teardown_final_logerror(rep=rep)
|
hook.pytest__teardown_final_logerror(report=rep)
|
||||||
|
|
||||||
def pytest_make_collect_report(collector):
|
def pytest_make_collect_report(collector):
|
||||||
result = excinfo = None
|
result = excinfo = None
|
||||||
|
@ -72,12 +72,12 @@ def pytest__teardown_final(session):
|
||||||
rep = TeardownErrorReport(call.excinfo)
|
rep = TeardownErrorReport(call.excinfo)
|
||||||
return rep
|
return rep
|
||||||
|
|
||||||
def pytest_report_teststatus(rep):
|
def pytest_report_teststatus(report):
|
||||||
if rep.when in ("setup", "teardown"):
|
if report.when in ("setup", "teardown"):
|
||||||
if rep.failed:
|
if report.failed:
|
||||||
# category, shortletter, verbose-word
|
# category, shortletter, verbose-word
|
||||||
return "error", "E", "ERROR"
|
return "error", "E", "ERROR"
|
||||||
elif rep.skipped:
|
elif report.skipped:
|
||||||
return "skipped", "s", "SKIPPED"
|
return "skipped", "s", "SKIPPED"
|
||||||
else:
|
else:
|
||||||
return "", "", ""
|
return "", "", ""
|
||||||
|
|
|
@ -82,7 +82,7 @@ class TerminalReporter:
|
||||||
self._tw.sep(sep, title, **markup)
|
self._tw.sep(sep, title, **markup)
|
||||||
|
|
||||||
def getcategoryletterword(self, rep):
|
def getcategoryletterword(self, rep):
|
||||||
res = self.config.hook.pytest_report_teststatus(rep=rep)
|
res = self.config.hook.pytest_report_teststatus(report=rep)
|
||||||
if res:
|
if res:
|
||||||
return res
|
return res
|
||||||
for cat in 'skipped failed passed ???'.split():
|
for cat in 'skipped failed passed ???'.split():
|
||||||
|
@ -184,8 +184,8 @@ class TerminalReporter:
|
||||||
fspath, lineno, msg = self._getreportinfo(item)
|
fspath, lineno, msg = self._getreportinfo(item)
|
||||||
self.write_fspath_result(fspath, "")
|
self.write_fspath_result(fspath, "")
|
||||||
|
|
||||||
def pytest__teardown_final_logerror(self, rep):
|
def pytest__teardown_final_logerror(self, report):
|
||||||
self.stats.setdefault("error", []).append(rep)
|
self.stats.setdefault("error", []).append(report)
|
||||||
|
|
||||||
def pytest_runtest_logreport(self, report):
|
def pytest_runtest_logreport(self, report):
|
||||||
rep = report
|
rep = report
|
||||||
|
|
|
@ -35,12 +35,11 @@ def pytest_runtest_makereport(__call__, item, call):
|
||||||
res.failed = True
|
res.failed = True
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def pytest_report_teststatus(rep):
|
def pytest_report_teststatus(report):
|
||||||
""" return shortletter and verbose word. """
|
if 'xfail' in report.keywords:
|
||||||
if 'xfail' in rep.keywords:
|
if report.skipped:
|
||||||
if rep.skipped:
|
|
||||||
return "xfailed", "x", "xfail"
|
return "xfailed", "x", "xfail"
|
||||||
elif rep.failed:
|
elif report.failed:
|
||||||
return "xpassed", "P", "xpass"
|
return "xpassed", "P", "xpass"
|
||||||
|
|
||||||
# called by the terminalreporter instance/plugin
|
# called by the terminalreporter instance/plugin
|
||||||
|
|
Loading…
Reference in New Issue