##// END OF EJS Templates
test that Application logging works
MinRK -
Show More
@@ -18,8 +18,11 b' Authors:'
18 #-----------------------------------------------------------------------------
18 #-----------------------------------------------------------------------------
19
19
20 import logging
20 import logging
21 from io import StringIO
21 from unittest import TestCase
22 from unittest import TestCase
22
23
24 import nose.tools as nt
25
23 from IPython.config.configurable import Configurable
26 from IPython.config.configurable import Configurable
24 from IPython.config.loader import Config
27 from IPython.config.loader import Config
25
28
@@ -80,6 +83,16 b' class MyApp(Application):'
80
83
81 class TestApplication(TestCase):
84 class TestApplication(TestCase):
82
85
86 def test_log(self):
87 stream = StringIO()
88 app = MyApp(log_level=logging.INFO)
89 handler = logging.StreamHandler(stream)
90 # trigger reconstruction of the log formatter
91 app.log.handlers = [handler]
92 app.log_format = "%(message)s"
93 app.log.info("hello")
94 nt.assert_in("hello", stream.getvalue())
95
83 def test_basic(self):
96 def test_basic(self):
84 app = MyApp()
97 app = MyApp()
85 self.assertEqual(app.name, u'myapp')
98 self.assertEqual(app.name, u'myapp')
General Comments 0
You need to be logged in to leave comments. Login now