[pypy-commit] pypy py3k: Port some gc.collect()s to test_generators in 3.2 test suite.

Manuel Jacob noreply at buildbot.pypy.org
Wed Feb 13 22:25:10 CET 2013


Author: Manuel Jacob
Branch: py3k
Changeset: r61207:242725f91070
Date: 2013-02-13 13:33 +0100
http://bitbucket.org/pypy/pypy/changeset/242725f91070/

Log:	Port some gc.collect()s to test_generators in 3.2 test suite.

diff --git a/lib-python/3.2/test/test_generators.py b/lib-python/3.2/test/test_generators.py
--- a/lib-python/3.2/test/test_generators.py
+++ b/lib-python/3.2/test/test_generators.py
@@ -1496,6 +1496,10 @@
 """
 
 coroutine_tests = """\
+A helper function to call gc.collect() without printing
+>>> import gc
+>>> def gc_collect(): gc.collect()
+
 Sending a value into a started generator:
 
 >>> def f():
@@ -1729,7 +1733,7 @@
 
 >>> g = f()
 >>> next(g)
->>> del g
+>>> del g; gc_collect()
 exiting
 
 
@@ -1744,7 +1748,7 @@
 
 >>> g = f()
 >>> next(g)
->>> del g
+>>> del g; gc_collect()
 finally
 
 
@@ -1770,6 +1774,7 @@
 >>> g = f()
 >>> next(g)
 >>> del g
+>>> gc_collect()
 >>> sys.stderr.getvalue().startswith(
 ...     "Exception RuntimeError: 'generator ignored GeneratorExit' in "
 ... )
@@ -1835,6 +1840,9 @@
 references. We add it to the standard suite so the routine refleak-tests
 would trigger if it starts being uncleanable again.
 
+>>> import gc
+>>> def gc_collect(): gc.collect()
+
 >>> import itertools
 >>> def leak():
 ...     class gen:
@@ -1886,6 +1894,7 @@
 ...
 ...     l = Leaker()
 ...     del l
+...     gc_collect()
 ...     err = sys.stderr.getvalue().strip()
 ...     err.startswith(
 ...         "Exception RuntimeError: RuntimeError() in <"


More information about the pypy-commit mailing list