diff options
author | John L. Villalovos <john.l.villalovos@intel.com> | 2015-10-05 15:51:49 -0700 |
---|---|---|
committer | John L. Villalovos <john.l.villalovos@intel.com> | 2015-10-07 17:58:43 -0700 |
commit | 67dd2956943261e845a866dab155208c51da937e (patch) | |
tree | 2dfdc23ab1914efc0b6c2d8f4f4143ed0fccb552 /fixtures/tests | |
parent | 5522eb9263e611803868b564bf4216f36e079580 (diff) | |
download | fixtures-git-67dd2956943261e845a866dab155208c51da937e.tar.gz |
FakeLogger: Mis-formatted log messages will raise Exception
When using the FakeLogger, have mis-formatted logging messages raise an
exception.
Normally when using the logging module, mis-formatted logging messages
will not raise an exception. Instead the exception will be printed but
not raised.
Change this behavior so that mis-formatted log messages can be caught
during unit-testing.
Closes-Bug: #1503049
Change-Id: I8d3e94d131289300ae020eb1d63306489e986335
Diffstat (limited to 'fixtures/tests')
-rw-r--r-- | fixtures/tests/_fixtures/test_logger.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fixtures/tests/_fixtures/test_logger.py b/fixtures/tests/_fixtures/test_logger.py index caff986..f8e11cc 100644 --- a/fixtures/tests/_fixtures/test_logger.py +++ b/fixtures/tests/_fixtures/test_logger.py @@ -17,6 +17,7 @@ import logging import sys import time +import testtools from testtools import TestCase from testtools.compat import StringIO @@ -140,6 +141,11 @@ class FakeLoggerTest(TestCase, TestWithFixtures): except: pass + def test_exceptionraised(self): + with FakeLogger(): + with testtools.ExpectedException(TypeError): + logging.info("Some message", "wrongarg") + class LogHandlerTest(TestCase, TestWithFixtures): |