mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Reset PyTest's catch_log_handler
after test since pyTest doesn't do it.
This commit is contained in:
parent
63c1d2edf0
commit
2ccf2d9d80
1 changed files with 19 additions and 1 deletions
|
@ -84,7 +84,9 @@ class LogCaptureHandler(
|
|||
):
|
||||
"""
|
||||
Subclassing PyTest's LogCaptureHandler in order to add the
|
||||
exc_info_on_loglevel functionality.
|
||||
exc_info_on_loglevel functionality and actually make it a NullHandler,
|
||||
it's only used to print log messages emmited during tests, which we
|
||||
have explicitly disabled in pytest.ini
|
||||
"""
|
||||
|
||||
|
||||
|
@ -461,6 +463,22 @@ def pytest_runtest_protocol(item, nextitem):
|
|||
del used_fixture_defs
|
||||
|
||||
|
||||
def pytest_runtest_teardown(item, nextitem):
|
||||
"""
|
||||
called after ``pytest_runtest_call``.
|
||||
|
||||
:arg nextitem: the scheduled-to-be-next test item (None if no further
|
||||
test item is scheduled). This argument can be used to
|
||||
perform exact teardowns, i.e. calling just enough finalizers
|
||||
so that nextitem only needs to call setup-functions.
|
||||
"""
|
||||
# PyTest doesn't reset the capturing log handler when done with it.
|
||||
# Reset it to free used memory and python objects
|
||||
# We currently have PyTest's log_print setting set to false, if it was
|
||||
# set to true, the call bellow would make PyTest not print any logs at all.
|
||||
item.catch_log_handler.reset()
|
||||
|
||||
|
||||
# <---- PyTest Tweaks ------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue