diff --git a/CHANGELOG b/CHANGELOG index d90ed609e..fb5f0d506 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,8 @@ Changes between 1.0.0 and 1.0.1 * 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 ===================================== diff --git a/py/test/plugin/hookspec.py b/py/test/plugin/hookspec.py index dd2fa8676..a82f718d1 100644 --- a/py/test/plugin/hookspec.py +++ b/py/test/plugin/hookspec.py @@ -91,7 +91,7 @@ def pytest__teardown_final(session): """ called before test session finishes. """ pytest__teardown_final.firstresult = True -def pytest__teardown_final_logerror(rep): +def pytest__teardown_final_logerror(report): """ called if runtest_teardown_final failed. """ # ------------------------------------------------------------------------- @@ -108,8 +108,8 @@ def pytest_sessionfinish(session, exitstatus): # hooks for influencing reporting (invoked from pytest_terminal) # ------------------------------------------------------------------------- -def pytest_report_teststatus(rep): - """ return shortletter and verbose word. """ +def pytest_report_teststatus(report): + """ return result-category, shortletter and verbose word for reporting.""" pytest_report_teststatus.firstresult = True def pytest_terminal_summary(terminalreporter): diff --git a/py/test/plugin/pytest_runner.py b/py/test/plugin/pytest_runner.py index a5ac4d362..3fb32eb4b 100644 --- a/py/test/plugin/pytest_runner.py +++ b/py/test/plugin/pytest_runner.py @@ -24,7 +24,7 @@ def pytest_sessionfinish(session, exitstatus): hook = session.config.hook rep = hook.pytest__teardown_final(session=session) if rep: - hook.pytest__teardown_final_logerror(rep=rep) + hook.pytest__teardown_final_logerror(report=rep) def pytest_make_collect_report(collector): result = excinfo = None @@ -72,12 +72,12 @@ def pytest__teardown_final(session): rep = TeardownErrorReport(call.excinfo) return rep -def pytest_report_teststatus(rep): - if rep.when in ("setup", "teardown"): - if rep.failed: +def pytest_report_teststatus(report): + if report.when in ("setup", "teardown"): + if report.failed: # category, shortletter, verbose-word return "error", "E", "ERROR" - elif rep.skipped: + elif report.skipped: return "skipped", "s", "SKIPPED" else: return "", "", "" diff --git a/py/test/plugin/pytest_terminal.py b/py/test/plugin/pytest_terminal.py index d4153d34a..158204b1e 100644 --- a/py/test/plugin/pytest_terminal.py +++ b/py/test/plugin/pytest_terminal.py @@ -82,7 +82,7 @@ class TerminalReporter: self._tw.sep(sep, title, **markup) def getcategoryletterword(self, rep): - res = self.config.hook.pytest_report_teststatus(rep=rep) + res = self.config.hook.pytest_report_teststatus(report=rep) if res: return res for cat in 'skipped failed passed ???'.split(): @@ -184,8 +184,8 @@ class TerminalReporter: fspath, lineno, msg = self._getreportinfo(item) self.write_fspath_result(fspath, "") - def pytest__teardown_final_logerror(self, rep): - self.stats.setdefault("error", []).append(rep) + def pytest__teardown_final_logerror(self, report): + self.stats.setdefault("error", []).append(report) def pytest_runtest_logreport(self, report): rep = report diff --git a/py/test/plugin/pytest_xfail.py b/py/test/plugin/pytest_xfail.py index b05292ea7..be85e8721 100644 --- a/py/test/plugin/pytest_xfail.py +++ b/py/test/plugin/pytest_xfail.py @@ -35,12 +35,11 @@ def pytest_runtest_makereport(__call__, item, call): res.failed = True return res -def pytest_report_teststatus(rep): - """ return shortletter and verbose word. """ - if 'xfail' in rep.keywords: - if rep.skipped: +def pytest_report_teststatus(report): + if 'xfail' in report.keywords: + if report.skipped: return "xfailed", "x", "xfail" - elif rep.failed: + elif report.failed: return "xpassed", "P", "xpass" # called by the terminalreporter instance/plugin