Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(264808)

Side by Side Diff: Lib/test/test_logging.py

Issue 16510: Using appropriate checks in tests
Patch Set: Created 5 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_kqueue.py ('k') | Lib/test/test_memoryview.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2001-2013 by Vinay Sajip. All Rights Reserved. 1 # Copyright 2001-2013 by Vinay Sajip. All Rights Reserved.
2 # 2 #
3 # Permission to use, copy, modify, and distribute this software and its 3 # Permission to use, copy, modify, and distribute this software and its
4 # documentation for any purpose and without fee is hereby granted, 4 # documentation for any purpose and without fee is hereby granted,
5 # provided that the above copyright notice appear in all copies and that 5 # provided that the above copyright notice appear in all copies and that
6 # both that copyright notice and this permission notice appear in 6 # both that copyright notice and this permission notice appear in
7 # supporting documentation, and that the name of Vinay Sajip 7 # supporting documentation, and that the name of Vinay Sajip
8 # not be used in advertising or publicity pertaining to distribution 8 # not be used in advertising or publicity pertaining to distribution
9 # of the software without specific, written prior permission. 9 # of the software without specific, written prior permission.
10 # VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 10 # VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
(...skipping 2995 matching lines...) Expand 10 before | Expand all | Expand 10 after
3006 BaseTest.tearDown(self) 3006 BaseTest.tearDown(self)
3007 3007
3008 def test_queue_handler(self): 3008 def test_queue_handler(self):
3009 self.que_logger.debug(self.next_message()) 3009 self.que_logger.debug(self.next_message())
3010 self.assertRaises(queue.Empty, self.queue.get_nowait) 3010 self.assertRaises(queue.Empty, self.queue.get_nowait)
3011 self.que_logger.info(self.next_message()) 3011 self.que_logger.info(self.next_message())
3012 self.assertRaises(queue.Empty, self.queue.get_nowait) 3012 self.assertRaises(queue.Empty, self.queue.get_nowait)
3013 msg = self.next_message() 3013 msg = self.next_message()
3014 self.que_logger.warning(msg) 3014 self.que_logger.warning(msg)
3015 data = self.queue.get_nowait() 3015 data = self.queue.get_nowait()
3016 self.assertTrue(isinstance(data, logging.LogRecord)) 3016 self.assertIsInstance(data, logging.LogRecord)
3017 self.assertEqual(data.name, self.que_logger.name) 3017 self.assertEqual(data.name, self.que_logger.name)
3018 self.assertEqual((data.msg, data.args), (msg, None)) 3018 self.assertEqual((data.msg, data.args), (msg, None))
3019 3019
3020 @unittest.skipUnless(hasattr(logging.handlers, 'QueueListener'), 3020 @unittest.skipUnless(hasattr(logging.handlers, 'QueueListener'),
3021 'logging.handlers.QueueListener required for this test' ) 3021 'logging.handlers.QueueListener required for this test' )
3022 def test_queue_listener(self): 3022 def test_queue_listener(self):
3023 handler = TestHandler(Matcher()) 3023 handler = TestHandler(Matcher())
3024 listener = logging.handlers.QueueListener(self.queue, handler) 3024 listener = logging.handlers.QueueListener(self.queue, handler)
3025 listener.start() 3025 listener.start()
3026 try: 3026 try:
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
4164 BasicConfigTest, LoggerAdapterTest, LoggerTest, 4164 BasicConfigTest, LoggerAdapterTest, LoggerTest,
4165 SMTPHandlerTest, FileHandlerTest, RotatingFileHandlerTest, 4165 SMTPHandlerTest, FileHandlerTest, RotatingFileHandlerTest,
4166 LastResortTest, LogRecordTest, ExceptionTest, 4166 LastResortTest, LogRecordTest, ExceptionTest,
4167 SysLogHandlerTest, HTTPHandlerTest, NTEventLogHandlerTest, 4167 SysLogHandlerTest, HTTPHandlerTest, NTEventLogHandlerTest,
4168 TimedRotatingFileHandlerTest, UnixSocketHandlerTest, 4168 TimedRotatingFileHandlerTest, UnixSocketHandlerTest,
4169 UnixDatagramHandlerTest, UnixSysLogHandlerTest 4169 UnixDatagramHandlerTest, UnixSysLogHandlerTest
4170 ) 4170 )
4171 4171
4172 if __name__ == "__main__": 4172 if __name__ == "__main__":
4173 test_main() 4173 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_kqueue.py ('k') | Lib/test/test_memoryview.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+