mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	Issue #11852: Add missing imports and update tests.
This commit is contained in:
		
							parent
							
								
									6c9e5b779f
								
							
						
					
					
						commit
						e723e96103
					
				
					 3 changed files with 20 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -26,6 +26,8 @@
 | 
			
		|||
 | 
			
		||||
import logging, socket, os, pickle, struct, time, re
 | 
			
		||||
from stat import ST_DEV, ST_INO, ST_MTIME
 | 
			
		||||
import queue
 | 
			
		||||
import threading
 | 
			
		||||
 | 
			
		||||
try:
 | 
			
		||||
    import codecs
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,6 +41,7 @@
 | 
			
		|||
import sys
 | 
			
		||||
import tempfile
 | 
			
		||||
from test.support import captured_stdout, run_with_locale, run_unittest
 | 
			
		||||
from test.support import TestHandler, Matcher
 | 
			
		||||
import textwrap
 | 
			
		||||
import unittest
 | 
			
		||||
import warnings
 | 
			
		||||
| 
						 | 
				
			
			@ -2092,6 +2093,21 @@ def test_queue_handler(self):
 | 
			
		|||
        self.assertEqual(data.name, self.que_logger.name)
 | 
			
		||||
        self.assertEqual((data.msg, data.args), (msg, None))
 | 
			
		||||
 | 
			
		||||
    def test_queue_listener(self):
 | 
			
		||||
        handler = TestHandler(Matcher())
 | 
			
		||||
        listener = logging.handlers.QueueListener(self.queue, handler)
 | 
			
		||||
        listener.start()
 | 
			
		||||
        try:
 | 
			
		||||
            self.que_logger.warning(self.next_message())
 | 
			
		||||
            self.que_logger.error(self.next_message())
 | 
			
		||||
            self.que_logger.critical(self.next_message())
 | 
			
		||||
        finally:
 | 
			
		||||
            listener.stop()
 | 
			
		||||
        self.assertTrue(handler.matches(levelno=logging.WARNING, message='1'))
 | 
			
		||||
        self.assertTrue(handler.matches(levelno=logging.ERROR, message='2'))
 | 
			
		||||
        self.assertTrue(handler.matches(levelno=logging.CRITICAL, message='3'))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class FormatterTest(unittest.TestCase):
 | 
			
		||||
    def setUp(self):
 | 
			
		||||
        self.common = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -60,6 +60,8 @@ Core and Builtins
 | 
			
		|||
Library
 | 
			
		||||
-------
 | 
			
		||||
 | 
			
		||||
- Issue #11852: Add missing imports and update tests.
 | 
			
		||||
 | 
			
		||||
- Issue #11467: Fix urlparse behavior when handling urls which contains scheme
 | 
			
		||||
  specific part only digits. Patch by Santoso Wijaya.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue