Commits

Manuel Jacob committed 242725f

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

Comments (0)

Files changed (1)

lib-python/3.2/test/test_generators.py

 """
 
 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():
 
 >>> g = f()
 >>> next(g)
->>> del g
+>>> del g; gc_collect()
 exiting
 
 
 
 >>> g = f()
 >>> next(g)
->>> del g
+>>> del g; gc_collect()
 finally
 
 
 >>> g = f()
 >>> next(g)
 >>> del g
+>>> gc_collect()
 >>> sys.stderr.getvalue().startswith(
 ...     "Exception RuntimeError: 'generator ignored GeneratorExit' in "
 ... )
 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:
 ...
 ...     l = Leaker()
 ...     del l
+...     gc_collect()
 ...     err = sys.stderr.getvalue().strip()
 ...     err.startswith(
 ...         "Exception RuntimeError: RuntimeError() in <"