'A context manager that asserts no NRT leak was created during
the execution of the enclosed block.'

@contextlib.contextmanager
def assertNoNRTLeak(self):

    old = rtsys.get_allocation_stats()
    (yield)
    new = rtsys.get_allocation_stats()
    total_alloc = (new.alloc - old.alloc)
    total_free = (new.free - old.free)
    total_mi_alloc = (new.mi_alloc - old.mi_alloc)
    total_mi_free = (new.mi_free - old.mi_free)
    self.assertEqual(total_alloc, total_free, 'number    of    data    allocs    !=    number    of    data    frees')
    self.assertEqual(total_mi_alloc, total_mi_free, 'number    of    meminfo    allocs    !=    number    of    meminfo    frees')
