Some tests did not pass on repeated calls (regrtest -R::)

Perform additional cleanup, mostly deleting from sys.modules, or clearing the warnings registry.
This commit is contained in:
Amaury Forgeot d'Arc 2008-04-18 23:31:33 +00:00
parent 6f34109384
commit 607bff1ebe
7 changed files with 29 additions and 9 deletions

View file

@ -683,6 +683,11 @@ def dash_R_cleanup(fs, ps, pic, abcs):
import struct, filecmp
from distutils.dir_util import _path_created
# Clear the warnings registry, so they can be displayed again
for mod in sys.modules.values():
if hasattr(mod, '__warningregistry__'):
del mod.__warningregistry__
# Restore some original values.
warnings.filters[:] = fs
copy_reg.dispatch_table.clear()