|
165 | 165 | import platform |
166 | 166 | import random |
167 | 167 | import re |
| 168 | +import shutil |
168 | 169 | import sys |
169 | 170 | import sysconfig |
170 | 171 | import tempfile |
@@ -887,6 +888,7 @@ def __init__(self, testname, verbose=0, quiet=False): |
887 | 888 | 'os.environ', 'sys.path', 'sys.path_hooks', '__import__', |
888 | 889 | 'warnings.filters', 'asyncore.socket_map', |
889 | 890 | 'logging._handlers', 'logging._handlerList', |
| 891 | + 'shutil.archive_formats', 'shutil.unpack_formats', |
890 | 892 | 'sys.warnoptions', 'threading._dangling', |
891 | 893 | 'multiprocessing.process._dangling') |
892 | 894 |
|
@@ -956,6 +958,23 @@ def restore_asyncore_socket_map(self, saved_map): |
956 | 958 | asyncore.close_all(ignore_all=True) |
957 | 959 | asyncore.socket_map.update(saved_map) |
958 | 960 |
|
| 961 | + def get_shutil_archive_formats(self): |
| 962 | + # we could call get_archives_formats() but that only returns the |
| 963 | + # registry keys; we want to check the values too (the functions that |
| 964 | + # are registered) |
| 965 | + return shutil._ARCHIVE_FORMATS, shutil._ARCHIVE_FORMATS.copy() |
| 966 | + def restore_shutil_archive_formats(self, saved): |
| 967 | + shutil._ARCHIVE_FORMATS = saved[0] |
| 968 | + shutil._ARCHIVE_FORMATS.clear() |
| 969 | + shutil._ARCHIVE_FORMATS.update(saved[1]) |
| 970 | + |
| 971 | + def get_shutil_unpack_formats(self): |
| 972 | + return shutil._UNPACK_FORMATS, shutil._UNPACK_FORMATS.copy() |
| 973 | + def restore_shutil_unpack_formats(self, saved): |
| 974 | + shutil._UNPACK_FORMATS = saved[0] |
| 975 | + shutil._UNPACK_FORMATS.clear() |
| 976 | + shutil._UNPACK_FORMATS.update(saved[1]) |
| 977 | + |
959 | 978 | def get_logging__handlers(self): |
960 | 979 | # _handlers is a WeakValueDictionary |
961 | 980 | return id(logging._handlers), logging._handlers, logging._handlers.copy() |
|
0 commit comments