Rev 3887: Add a test which fails because we don't call cleanup funcs during deconstruction. in http://bzr.arbash-meinel.com/branches/bzr/1.11/fifo_cache

John Arbash Meinel john at arbash-meinel.com
Tue Dec 9 21:39:37 GMT 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.11/fifo_cache

------------------------------------------------------------
revno: 3887
revision-id: john at arbash-meinel.com-20081209213917-c5ko2gvw831txpt8
parent: john at arbash-meinel.com-20081209213549-yc1mqv3l5gun9c63
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: fifo_cache
timestamp: Tue 2008-12-09 15:39:17 -0600
message:
  Add a test which fails because we don't call cleanup funcs during deconstruction.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_fifo_cache.py'
--- a/bzrlib/tests/test_fifo_cache.py	2008-12-09 21:35:49 +0000
+++ b/bzrlib/tests/test_fifo_cache.py	2008-12-09 21:39:17 +0000
@@ -136,3 +136,16 @@
         del log[:]
         c.clear()
         self.assertEqual([(3, 4)], log)
+
+    def test_cleanup_at_deconstruct(self):
+        log = []
+        def logging_cleanup(key, value):
+            log.append((key, value))
+        c = fifo_cache.FIFOCache()
+        c.add(1, 2, cleanup=logging_cleanup)
+        del c
+        # TODO: We currently don't support calling the cleanup() funcs during
+        #       __del__. We might want to consider implementing this.
+        self.expectFailure("we don't call cleanups during __del__",
+                           self.assertEqual, [(1, 2)], log)
+        self.assertEqual([(1, 2)], log)



More information about the bazaar-commits mailing list