[Python-checkins] r87078 - python/branches/py3k/Lib/test/regrtest.py

nick.coghlan python-checkins at python.org
Sun Dec 5 07:45:03 CET 2010


Author: nick.coghlan
Date: Sun Dec  5 07:45:03 2010
New Revision: 87078

Log:
Issue 10517 investigation: regrtest now checks for alterations to the logging state in the current process (and yes, test_pydoc alters it)

Modified:
   python/branches/py3k/Lib/test/regrtest.py

Modified: python/branches/py3k/Lib/test/regrtest.py
==============================================================================
--- python/branches/py3k/Lib/test/regrtest.py	(original)
+++ python/branches/py3k/Lib/test/regrtest.py	Sun Dec  5 07:45:03 2010
@@ -167,6 +167,7 @@
 import tempfile
 import platform
 import sysconfig
+import logging
 
 
 # Some times __path__ and __file__ are not absolute (e.g. while running from
@@ -814,7 +815,7 @@
 
     resources = ('sys.argv', 'cwd', 'sys.stdin', 'sys.stdout', 'sys.stderr',
                  'os.environ', 'sys.path', 'sys.path_hooks', '__import__',
-                 'warnings.filters', 'asyncore.socket_map')
+                 'warnings.filters', 'asyncore.socket_map', 'logging._handlers')
 
     def get_sys_argv(self):
         return id(sys.argv), sys.argv, sys.argv[:]
@@ -882,6 +883,15 @@
             asyncore.close_all(ignore_all=True)
             asyncore.socket_map.update(saved_map)
 
+    def get_logging__handlers(self):
+        # _handlers is a WeakValueDictionary
+        # _handlerList is a list of weakrefs to handlers
+        return (id(logging._handlers), logging._handlers, logging._handlers.copy(),
+                id(logging._handlerList), logging._handlerList, logging._handlerList[:])
+    def restore_logging__handlers(self, saved_handlers):
+        # Can't easily revert the logging state
+        pass
+
     def resource_info(self):
         for name in self.resources:
             method_suffix = name.replace('.', '_')


More information about the Python-checkins mailing list