When using -R, lots of "*** DocTestRunner.merge:" nuisance messages

appear.  Get rid of them by nuking doctest's default DocTestRunner
instance as part of cleanup().  Also cleanup() before running the
first test repetition (the test was run once before we get into
the -R branch).
This commit is contained in:
Tim Peters 2006-04-13 23:12:24 +00:00
parent 8e6480ca02
commit 7db4f2460f
1 changed files with 3 additions and 1 deletions

View File

@ -520,7 +520,7 @@ def runtest(test, generate, verbose, quiet, testdir=None, huntrleaks=False):
import gc import gc
def cleanup(): def cleanup():
import _strptime, linecache, warnings, dircache import _strptime, linecache, warnings, dircache
import urlparse, urllib, urllib2, mimetypes import urlparse, urllib, urllib2, mimetypes, doctest
from distutils.dir_util import _path_created from distutils.dir_util import _path_created
_path_created.clear() _path_created.clear()
warnings.filters[:] = fs warnings.filters[:] = fs
@ -537,6 +537,7 @@ def runtest(test, generate, verbose, quiet, testdir=None, huntrleaks=False):
dircache.reset() dircache.reset()
linecache.clearcache() linecache.clearcache()
mimetypes._default_mime_types() mimetypes._default_mime_types()
doctest.master = None
if indirect_test: if indirect_test:
def run_the_test(): def run_the_test():
indirect_test() indirect_test()
@ -548,6 +549,7 @@ def runtest(test, generate, verbose, quiet, testdir=None, huntrleaks=False):
print >> sys.stderr, "beginning", repcount, "repetitions" print >> sys.stderr, "beginning", repcount, "repetitions"
print >> sys.stderr, \ print >> sys.stderr, \
("1234567890"*(repcount//10 + 1))[:repcount] ("1234567890"*(repcount//10 + 1))[:repcount]
cleanup()
for i in range(repcount): for i in range(repcount):
rc = sys.gettotalrefcount() rc = sys.gettotalrefcount()
run_the_test() run_the_test()