Merge pull request #4691 from nicoddemus/config-terminal-summary-hook
Add config to pytest_terminal_summary hook
This commit is contained in:
commit
b41dc03930
|
@ -0,0 +1 @@
|
||||||
|
``pytest_terminal_summary`` hook now can also receive a ``config`` parameter.
|
|
@ -489,13 +489,14 @@ def pytest_report_teststatus(report, config):
|
||||||
Stops at first non-None result, see :ref:`firstresult` """
|
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.
|
"""Add a section to terminal summary reporting.
|
||||||
|
|
||||||
:param _pytest.terminal.TerminalReporter terminalreporter: the internal terminal reporter object
|
: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 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.
|
The ``config`` parameter.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -633,7 +633,7 @@ class TerminalReporter(object):
|
||||||
)
|
)
|
||||||
if exitstatus in summary_exit_codes:
|
if exitstatus in summary_exit_codes:
|
||||||
self.config.hook.pytest_terminal_summary(
|
self.config.hook.pytest_terminal_summary(
|
||||||
terminalreporter=self, exitstatus=exitstatus
|
terminalreporter=self, exitstatus=exitstatus, config=self.config
|
||||||
)
|
)
|
||||||
if exitstatus == EXIT_INTERRUPTED:
|
if exitstatus == EXIT_INTERRUPTED:
|
||||||
self._report_keyboardinterrupt()
|
self._report_keyboardinterrupt()
|
||||||
|
|
Loading…
Reference in New Issue