[Python-checkins] r72660 - in python/branches/py3k: Lib/test/regrtest.py
collin.winter
python-checkins at python.org
Fri May 15 03:20:22 CEST 2009
Author: collin.winter
Date: Fri May 15 03:20:21 2009
New Revision: 72660
Log:
Merged revisions 72658 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72658 | collin.winter | 2009-05-14 16:26:30 -0700 (Thu, 14 May 2009) | 1 line
Issue 6024: make regrtest.py promote refleaks to test failures.
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Lib/test/regrtest.py
Modified: python/branches/py3k/Lib/test/regrtest.py
==============================================================================
--- python/branches/py3k/Lib/test/regrtest.py (original)
+++ python/branches/py3k/Lib/test/regrtest.py Fri May 15 03:20:21 2009
@@ -598,6 +598,7 @@
else:
cfp = io.StringIO() # XXX Should use io.StringIO()
+ refleak = False # True if the test leaked references.
try:
save_stdout = sys.stdout
try:
@@ -619,7 +620,7 @@
if indirect_test is not None:
indirect_test()
if huntrleaks:
- dash_R(the_module, test, indirect_test, huntrleaks)
+ refleak = dash_R(the_module, test, indirect_test, huntrleaks)
test_time = time.time() - start_time
test_times.append((test_time, test))
finally:
@@ -649,6 +650,8 @@
sys.stdout.flush()
return 0
else:
+ if refleak:
+ return 0
if not cfp:
return 1
output = cfp.getvalue()
@@ -698,6 +701,11 @@
"removed: %s" % (testname, kind, name, msg)), file=sys.stderr)
def dash_R(the_module, test, indirect_test, huntrleaks):
+ """Run a test multiple times, looking for reference leaks.
+
+ Returns:
+ False if the test didn't leak references; True if we detected refleaks.
+ """
# This code is hackish and inelegant, but it seems to do the job.
import copyreg, _abcoll
@@ -745,6 +753,8 @@
refrep = open(fname, "a")
print(msg, file=refrep)
refrep.close()
+ return True
+ return False
def dash_R_cleanup(fs, ps, pic, abcs):
import gc, copyreg
More information about the Python-checkins
mailing list