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

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

Issue 16510: Using appropriate checks in tests
Patch Set: Created 6 years, 5 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_list.py ('k') | Lib/test/test_long.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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2001-2012 by Vinay Sajip. All Rights Reserved. 3 # Copyright 2001-2012 by Vinay Sajip. All Rights Reserved.
4 # 4 #
5 # Permission to use, copy, modify, and distribute this software and its 5 # Permission to use, copy, modify, and distribute this software and its
6 # documentation for any purpose and without fee is hereby granted, 6 # documentation for any purpose and without fee is hereby granted,
7 # provided that the above copyright notice appear in all copies and that 7 # provided that the above copyright notice appear in all copies and that
8 # both that copyright notice and this permission notice appear in 8 # both that copyright notice and this permission notice appear in
9 # supporting documentation, and that the name of Vinay Sajip 9 # supporting documentation, and that the name of Vinay Sajip
10 # not be used in advertising or publicity pertaining to distribution 10 # not be used in advertising or publicity pertaining to distribution
(...skipping 2894 matching lines...) Expand 10 before | Expand all | Expand 10 after
2905 BaseTest.tearDown(self) 2905 BaseTest.tearDown(self)
2906 2906
2907 def test_queue_handler(self): 2907 def test_queue_handler(self):
2908 self.que_logger.debug(self.next_message()) 2908 self.que_logger.debug(self.next_message())
2909 self.assertRaises(queue.Empty, self.queue.get_nowait) 2909 self.assertRaises(queue.Empty, self.queue.get_nowait)
2910 self.que_logger.info(self.next_message()) 2910 self.que_logger.info(self.next_message())
2911 self.assertRaises(queue.Empty, self.queue.get_nowait) 2911 self.assertRaises(queue.Empty, self.queue.get_nowait)
2912 msg = self.next_message() 2912 msg = self.next_message()
2913 self.que_logger.warning(msg) 2913 self.que_logger.warning(msg)
2914 data = self.queue.get_nowait() 2914 data = self.queue.get_nowait()
2915 self.assertTrue(isinstance(data, logging.LogRecord)) 2915 self.assertIsInstance(data, logging.LogRecord)
2916 self.assertEqual(data.name, self.que_logger.name) 2916 self.assertEqual(data.name, self.que_logger.name)
2917 self.assertEqual((data.msg, data.args), (msg, None)) 2917 self.assertEqual((data.msg, data.args), (msg, None))
2918 2918
2919 @unittest.skipUnless(hasattr(logging.handlers, 'QueueListener'), 2919 @unittest.skipUnless(hasattr(logging.handlers, 'QueueListener'),
2920 'logging.handlers.QueueListener required for this test' ) 2920 'logging.handlers.QueueListener required for this test' )
2921 def test_queue_listener(self): 2921 def test_queue_listener(self):
2922 handler = TestHandler(Matcher()) 2922 handler = TestHandler(Matcher())
2923 listener = logging.handlers.QueueListener(self.queue, handler) 2923 listener = logging.handlers.QueueListener(self.queue, handler)
2924 listener.start() 2924 listener.start()
2925 try: 2925 try:
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
3958 QueueHandlerTest, ShutdownTest, ModuleLevelMiscTest, 3958 QueueHandlerTest, ShutdownTest, ModuleLevelMiscTest,
3959 BasicConfigTest, LoggerAdapterTest, LoggerTest, 3959 BasicConfigTest, LoggerAdapterTest, LoggerTest,
3960 SMTPHandlerTest, FileHandlerTest, RotatingFileHandlerTest, 3960 SMTPHandlerTest, FileHandlerTest, RotatingFileHandlerTest,
3961 LastResortTest, LogRecordTest, ExceptionTest, 3961 LastResortTest, LogRecordTest, ExceptionTest,
3962 SysLogHandlerTest, HTTPHandlerTest, NTEventLogHandlerTest, 3962 SysLogHandlerTest, HTTPHandlerTest, NTEventLogHandlerTest,
3963 TimedRotatingFileHandlerTest 3963 TimedRotatingFileHandlerTest
3964 ) 3964 )
3965 3965
3966 if __name__ == "__main__": 3966 if __name__ == "__main__":
3967 test_main() 3967 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_list.py ('k') | Lib/test/test_long.py » ('j') | no next file with comments »

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