import py import test_c lst = [] for fname in test_c.__dict__: if fname.startswith('test_'): lst.append(fname) lst.sort() for retry in range(170): for fname in lst: print fname try: getattr(test_c, fname)() except Exception as e: print e import gc gc.collect() gc.collect() gc.collect() gc.collect() gc.collect() gc.collect() gc.collect()