X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tests%2Flogging_utils_test.py;h=99ceeaedada958c9912a1d8e15fc2ee8d4640956;hb=532df2c5b57c7517dfb3dddd8c1358fbadf8baf3;hp=87c00d64e30e3a9b0a90e08658742ad0ae2739aa;hpb=c79ecbf708a63a54a9c3e8d189b65d4794930082;p=python_utils.git diff --git a/tests/logging_utils_test.py b/tests/logging_utils_test.py index 87c00d6..99ceeae 100755 --- a/tests/logging_utils_test.py +++ b/tests/logging_utils_test.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + +"""logging_utils unittest.""" + import os import sys import tempfile @@ -11,7 +15,6 @@ import unittest_utils as uu class TestLoggingUtils(unittest.TestCase): - def test_output_context(self): unique_suffix = sutils.generate_uuid(True) filename = f'/tmp/logging_utils_test.{unique_suffix}' @@ -20,11 +23,11 @@ class TestLoggingUtils(unittest.TestCase): with tempfile.SpooledTemporaryFile(mode='r+') as tmpfile1: with uu.RecordStdout() as record: with lutils.OutputMultiplexerContext( - lutils.OutputMultiplexer.Destination.FILENAMES | - lutils.OutputMultiplexer.Destination.FILEHANDLES | - lutils.OutputMultiplexer.Destination.LOG_INFO, - filenames = [filename, '/dev/null'], - handles = [tmpfile1, sys.stdout], + lutils.OutputMultiplexer.Destination.FILENAMES + | lutils.OutputMultiplexer.Destination.FILEHANDLES + | lutils.OutputMultiplexer.Destination.LOG_INFO, + filenames=[filename, '/dev/null'], + handles=[tmpfile1, sys.stdout], ) as mplex: mplex.print(secret_message, end='') @@ -46,8 +49,7 @@ class TestLoggingUtils(unittest.TestCase): with uu.RecordMultipleStreams(sys.stderr, sys.stdout) as record: print("This is a test!") print("This is one too.", file=sys.stderr) - self.assertEqual(record().readlines(), - ["This is a test!\n", "This is one too.\n"]) + self.assertEqual(record().readlines(), ["This is a test!\n", "This is one too.\n"]) if __name__ == '__main__':