Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Bruno Oliveira <[email protected]>
  • Loading branch information
graingert and nicoddemus authored Nov 21, 2024
1 parent 4391b12 commit a76eb1f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion changelog/12981.bugfix.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Prevent exceptions in pytest.Config.add_cleanup preventing further cleanups
Prevent exceptions in :func:`pytest.Config.add_cleanup` preventing further cleanups.
5 changes: 4 additions & 1 deletion src/_pytest/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,10 @@ def inipath(self) -> pathlib.Path | None:

def add_cleanup(self, func: _T_callback) -> _T_callback:
"""Add a function to be called when the config object gets out of
use (usually coinciding with pytest_unconfigure)."""
use (usually coinciding with pytest_unconfigure).
Returns the passed function.
"""
self._exit_stack.callback(func)
return func

Expand Down

0 comments on commit a76eb1f

Please sign in to comment.