Back to index

python3.2  3.2.2
Classes | Functions
test.test_gc Namespace Reference

Classes

class  C1055820
 Support code. More...
class  GC_Detector
class  GCTests
class  GCTogglingTests

Functions

def test_main

Function Documentation

Definition at line 671 of file test_gc.py.

00671 
00672 def test_main():
00673     enabled = gc.isenabled()
00674     gc.disable()
00675     assert not gc.isenabled()
00676     debug = gc.get_debug()
00677     gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak
00678 
00679     try:
00680         gc.collect() # Delete 2nd generation garbage
00681         run_unittest(GCTests, GCTogglingTests)
00682     finally:
00683         gc.set_debug(debug)
00684         # test gc.enable() even if GC is disabled by default
00685         if verbose:
00686             print("restoring automatic collection")
00687         # make sure to always test gc.enable()
00688         gc.enable()
00689         assert gc.isenabled()
00690         if not enabled:
00691             gc.disable()

Here is the call graph for this function: