Skip to content

Commit

Permalink
Use newly named log handler TstSuiteLoggingHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
Ch3LL committed Dec 20, 2019
1 parent b809d74 commit 095a067
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions doc/topics/tutorials/writing_tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,10 @@ can be used
.. code-block:: python
# Import logging handler
from tests.support.helpers import TestsLoggingHandler
from tests.support.helpers import TstSuiteLoggingHandler
# .. inside test
with TestsLoggingHandler() as handler:
with TstSuiteLoggingHandler() as handler:
for message in handler.messages:
if message.startswith('ERROR: This is the error message we seek'):
break
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/modules/test_cmdmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.unit import TestCase, skipIf
from tests.support.runtests import RUNTIME_VARS
from tests.support.helpers import TestsLoggingHandler
from tests.support.helpers import TstSuiteLoggingHandler
from tests.support.mock import (
mock_open,
Mock,
Expand Down Expand Up @@ -448,7 +448,7 @@ def test_run_all_output_loglevel_quiet(self):

msg = "INFO:Executing command 'some command' in directory"
with patch('salt.utils.timed_subprocess.TimedProc', proc):
with TestsLoggingHandler() as log_handler:
with TstSuiteLoggingHandler() as log_handler:
ret = cmdmod.run_all('some command', output_loglevel='quiet')
assert not [x for x in log_handler.messages if msg in x]

Expand All @@ -464,7 +464,7 @@ def test_run_all_output_loglevel_debug(self):

msg = "INFO:Executing command 'some command' in directory"
with patch('salt.utils.timed_subprocess.TimedProc', proc):
with TestsLoggingHandler() as log_handler:
with TstSuiteLoggingHandler() as log_handler:
ret = cmdmod.run_all('some command', output_loglevel='debug')
assert [x for x in log_handler.messages if msg in x]

Expand Down

0 comments on commit 095a067

Please sign in to comment.