From 6c3b86369fe3ab68ac252ed89f3faa3e6496aba1 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 29 Jan 2019 15:41:13 -0200 Subject: [PATCH 1/2] Add config to pytest_terminal_summary hook The docs stated that this hook got the 'config' parameter in 3.5, but the docs wre probably changed by mistake. --- src/_pytest/hookspec.py | 5 +++-- src/_pytest/terminal.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/_pytest/hookspec.py b/src/_pytest/hookspec.py index 4f346ba2586..3b6c9a7d15a 100644 --- a/src/_pytest/hookspec.py +++ b/src/_pytest/hookspec.py @@ -489,13 +489,14 @@ def pytest_report_teststatus(report, config): Stops at first non-None result, see :ref:`firstresult` """ -def pytest_terminal_summary(terminalreporter, exitstatus): +def pytest_terminal_summary(terminalreporter, exitstatus, config): """Add a section to terminal summary reporting. :param _pytest.terminal.TerminalReporter terminalreporter: the internal terminal reporter object :param int exitstatus: the exit status that will be reported back to the OS + :param _pytest.config.Config config: pytest config object - .. versionadded:: 3.5 + .. versionadded:: 4.2 The ``config`` parameter. """ diff --git a/src/_pytest/terminal.py b/src/_pytest/terminal.py index 3c6504b666a..bb1c312cd56 100644 --- a/src/_pytest/terminal.py +++ b/src/_pytest/terminal.py @@ -633,7 +633,7 @@ def pytest_sessionfinish(self, exitstatus): ) if exitstatus in summary_exit_codes: self.config.hook.pytest_terminal_summary( - terminalreporter=self, exitstatus=exitstatus + terminalreporter=self, exitstatus=exitstatus, config=self.config ) if exitstatus == EXIT_INTERRUPTED: self._report_keyboardinterrupt() From 7e8e593a454ca2ced9e275a61cf619d5aab65c05 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 29 Jan 2019 15:52:45 -0200 Subject: [PATCH 2/2] Add CHANGELOG entry for #4691 --- changelog/4691.feature.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/4691.feature.rst diff --git a/changelog/4691.feature.rst b/changelog/4691.feature.rst new file mode 100644 index 00000000000..8206d05699f --- /dev/null +++ b/changelog/4691.feature.rst @@ -0,0 +1 @@ +``pytest_terminal_summary`` hook now can also receive a ``config`` parameter.