[Python-checkins] cpython (3.2): Add a regrtest cleanup check for shutil registries

eric.araujo python-checkins at python.org
Tue Nov 29 17:15:08 CET 2011


http://hg.python.org/cpython/rev/7292a6c21fe5
changeset:   73786:7292a6c21fe5
branch:      3.2
user:        Éric Araujo <merwok at netwok.org>
date:        Tue Nov 29 16:45:07 2011 +0100
summary:
  Add a regrtest cleanup check for shutil registries

files:
  Lib/test/regrtest.py |  19 +++++++++++++++++++
  1 files changed, 19 insertions(+), 0 deletions(-)


diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -165,6 +165,7 @@
 import platform
 import random
 import re
+import shutil
 import sys
 import sysconfig
 import tempfile
@@ -887,6 +888,7 @@
                  'os.environ', 'sys.path', 'sys.path_hooks', '__import__',
                  'warnings.filters', 'asyncore.socket_map',
                  'logging._handlers', 'logging._handlerList',
+                 'shutil.archive_formats', 'shutil.unpack_formats',
                  'sys.warnoptions', 'threading._dangling',
                  'multiprocessing.process._dangling')
 
@@ -956,6 +958,23 @@
             asyncore.close_all(ignore_all=True)
             asyncore.socket_map.update(saved_map)
 
+    def get_shutil_archive_formats(self):
+        # we could call get_archives_formats() but that only returns the
+        # registry keys; we want to check the values too (the functions that
+        # are registered)
+        return shutil._ARCHIVE_FORMATS, shutil._ARCHIVE_FORMATS.copy()
+    def restore_shutil_archive_formats(self, saved):
+        shutil._ARCHIVE_FORMATS = saved[0]
+        shutil._ARCHIVE_FORMATS.clear()
+        shutil._ARCHIVE_FORMATS.update(saved[1])
+
+    def get_shutil_unpack_formats(self):
+        return shutil._UNPACK_FORMATS, shutil._UNPACK_FORMATS.copy()
+    def restore_shutil_unpack_formats(self, saved):
+        shutil._UNPACK_FORMATS = saved[0]
+        shutil._UNPACK_FORMATS.clear()
+        shutil._UNPACK_FORMATS.update(saved[1])
+
     def get_logging__handlers(self):
         # _handlers is a WeakValueDictionary
         return id(logging._handlers), logging._handlers, logging._handlers.copy()

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list