Skip to content

Commit b41dc03

Browse files
authored
Merge pull request #4691 from nicoddemus/config-terminal-summary-hook
Add config to pytest_terminal_summary hook
2 parents 3e0e819 + 7e8e593 commit b41dc03

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

changelog/4691.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
``pytest_terminal_summary`` hook now can also receive a ``config`` parameter.

src/_pytest/hookspec.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,13 +489,14 @@ def pytest_report_teststatus(report, config):
489489
Stops at first non-None result, see :ref:`firstresult` """
490490

491491

492-
def pytest_terminal_summary(terminalreporter, exitstatus):
492+
def pytest_terminal_summary(terminalreporter, exitstatus, config):
493493
"""Add a section to terminal summary reporting.
494494
495495
:param _pytest.terminal.TerminalReporter terminalreporter: the internal terminal reporter object
496496
:param int exitstatus: the exit status that will be reported back to the OS
497+
:param _pytest.config.Config config: pytest config object
497498
498-
.. versionadded:: 3.5
499+
.. versionadded:: 4.2
499500
The ``config`` parameter.
500501
"""
501502

src/_pytest/terminal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ def pytest_sessionfinish(self, exitstatus):
633633
)
634634
if exitstatus in summary_exit_codes:
635635
self.config.hook.pytest_terminal_summary(
636-
terminalreporter=self, exitstatus=exitstatus
636+
terminalreporter=self, exitstatus=exitstatus, config=self.config
637637
)
638638
if exitstatus == EXIT_INTERRUPTED:
639639
self._report_keyboardinterrupt()

0 commit comments

Comments
 (0)