diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2010-12-05 06:45:03 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2010-12-05 06:45:03 (GMT) |
commit | 7d8197516a138b5e21e446d5f0dcd767747f35d4 (patch) | |
tree | 06c84f8b09e9f858bc10560d8f2c49fc06150ffd /Lib/test/regrtest.py | |
parent | e5e728babd88a1ce2654a12b7fd4973f601106a4 (diff) | |
download | cpython-7d8197516a138b5e21e446d5f0dcd767747f35d4.zip cpython-7d8197516a138b5e21e446d5f0dcd767747f35d4.tar.gz cpython-7d8197516a138b5e21e446d5f0dcd767747f35d4.tar.bz2 |
Issue 10626 investigation: regrtest now checks for alterations to the logging state in the current process (and yes, test_pydoc alters it)
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-x | Lib/test/regrtest.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 5dc7f18..e16594f 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -167,6 +167,7 @@ from inspect import isabstract 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 @@ class saved_test_environment: 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 @@ class saved_test_environment: 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('.', '_') |