(self)
| 398 | |
| 399 | @support.impl_detail('Relies on sys.getrefcount', cpython=True) |
| 400 | def test_refleak(self): |
| 401 | # If an OptionParser is carrying around a reference to a large |
| 402 | # object, various cycles can prevent it from being GC'd in |
| 403 | # a timely fashion. destroy() breaks the cycles to ensure stuff |
| 404 | # can be cleaned up. |
| 405 | big_thing = [42] |
| 406 | refcount = sys.getrefcount(big_thing) |
| 407 | parser = OptionParser() |
| 408 | parser.add_option("-a", "--aaarggh") |
| 409 | parser.big_thing = big_thing |
| 410 | |
| 411 | parser.destroy() |
| 412 | #self.assertEqual(refcount, sys.getrefcount(big_thing)) |
| 413 | del parser |
| 414 | self.assertEqual(refcount, sys.getrefcount(big_thing)) |
| 415 | |
| 416 | |
| 417 | class TestOptionValues(BaseTest): |
nothing calls this directly
no test coverage detected