diff options
Diffstat (limited to 'Lib/test/test_logging.py')
| -rw-r--r-- | Lib/test/test_logging.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 8884562961..6d0b23441b 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -698,6 +698,20 @@ class StreamHandlerTest(BaseTest): finally: logging.raiseExceptions = old_raise + def test_stream_setting(self): + """ + Test setting the handler's stream + """ + h = logging.StreamHandler() + stream = io.StringIO() + old = h.setStream(stream) + self.assertIs(old, sys.stderr) + actual = h.setStream(old) + self.assertIs(actual, stream) + # test that setting to existing value returns None + actual = h.setStream(old) + self.assertIsNone(actual) + # -- The following section could be moved into a server_helper.py module # -- if it proves to be of wider utility than just test_logging |
