summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-01-09 17:12:31 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-01-09 17:12:31 (GMT)
commita118c4fa7909c62e7aee1e25e02bc4172683772e (patch)
tree1ae8dc52eda240932a0bccd85a496419b6c28816 /Lib/test
parent7282ff6d5b56825e74c0715aea86e927d2fd339f (diff)
parent50b82c765f82c45ee317380a5f5f85e23e7fef36 (diff)
downloadcpython-a118c4fa7909c62e7aee1e25e02bc4172683772e.zip
cpython-a118c4fa7909c62e7aee1e25e02bc4172683772e.tar.gz
cpython-a118c4fa7909c62e7aee1e25e02bc4172683772e.tar.bz2
merge 3.3
Diffstat (limited to 'Lib/test')
-rwxr-xr-xLib/test/regrtest.py9
-rw-r--r--Lib/test/test_pkgutil.py5
2 files changed, 6 insertions, 8 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index c1c831f..17cbccb 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -1373,9 +1373,10 @@ def dash_R(the_module, test, indirect_test, huntrleaks):
try:
import zipimport
except ImportError:
- zdc = None # Run unmodified on platforms without zipimport support
+ zsc = zdc = None # Run unmodified on platforms without zipimport support
else:
zdc = zipimport._zip_directory_cache.copy()
+ zsc = zipimport._zip_stat_cache.copy()
abcs = {}
for abc in [getattr(collections.abc, a) for a in collections.abc.__all__]:
if not isabstract(abc):
@@ -1394,7 +1395,7 @@ def dash_R(the_module, test, indirect_test, huntrleaks):
sys.stderr.flush()
for i in range(repcount):
indirect_test()
- alloc_after, rc_after = dash_R_cleanup(fs, ps, pic, zdc, abcs)
+ alloc_after, rc_after = dash_R_cleanup(fs, ps, pic, zdc, zsc, abcs)
sys.stderr.write('.')
sys.stderr.flush()
if i >= nwarmup:
@@ -1428,7 +1429,7 @@ def dash_R(the_module, test, indirect_test, huntrleaks):
failed = True
return failed
-def dash_R_cleanup(fs, ps, pic, zdc, abcs):
+def dash_R_cleanup(fs, ps, pic, zdc, zsc, abcs):
import gc, copyreg
import _strptime, linecache
import urllib.parse, urllib.request, mimetypes, doctest
@@ -1454,6 +1455,8 @@ def dash_R_cleanup(fs, ps, pic, zdc, abcs):
else:
zipimport._zip_directory_cache.clear()
zipimport._zip_directory_cache.update(zdc)
+ zipimport._zip_stat_cache.clear()
+ zipimport._zip_stat_cache.update(zsc)
# clear type cache
sys._clear_type_cache()
diff --git a/Lib/test/test_pkgutil.py b/Lib/test/test_pkgutil.py
index aaa9d8d..7a1cd41 100644
--- a/Lib/test/test_pkgutil.py
+++ b/Lib/test/test_pkgutil.py
@@ -349,11 +349,6 @@ class ImportlibMigrationTests(unittest.TestCase):
def test_main():
run_unittest(PkgutilTests, PkgutilPEP302Tests, ExtendPathTests,
NestedNamespacePackageTest, ImportlibMigrationTests)
- # this is necessary if test is run repeated (like when finding leaks)
- import zipimport
- import importlib
- zipimport._zip_directory_cache.clear()
- importlib.invalidate_caches()
if __name__ == '__main__':