[CalendarServer-changes] [6346] CalendarServer/branches/users/glyph/more-deferreds-6/txdav/caldav/ datastore/test/test_file.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Sep 22 21:41:15 PDT 2010


Revision: 6346
          http://trac.macosforge.org/projects/calendarserver/changeset/6346
Author:   glyph at apple.com
Date:     2010-09-22 21:41:14 -0700 (Wed, 22 Sep 2010)
Log Message:
-----------
clean up all lingering transactions

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/more-deferreds-6/txdav/caldav/datastore/test/test_file.py

Modified: CalendarServer/branches/users/glyph/more-deferreds-6/txdav/caldav/datastore/test/test_file.py
===================================================================
--- CalendarServer/branches/users/glyph/more-deferreds-6/txdav/caldav/datastore/test/test_file.py	2010-09-23 04:40:20 UTC (rev 6345)
+++ CalendarServer/branches/users/glyph/more-deferreds-6/txdav/caldav/datastore/test/test_file.py	2010-09-23 04:41:14 UTC (rev 6346)
@@ -63,7 +63,7 @@
     storePath.copyTo(calendarPath)
 
     test.calendarStore = CalendarStore(storeRootPath, test.notifierFactory)
-    test.txn = test.calendarStore.newTransaction()
+    test.txn = test.calendarStore.newTransaction(test.id() + "(old)")
     assert test.calendarStore is not None, "No calendar store?"
 
 
@@ -289,12 +289,16 @@
         )
 
 
+    counter = 0
     def _refresh(self):
         """
         Re-read the (committed) home1 and calendar1 objects in a new
         transaction.
         """
-        self.txn = self.calendarStore.newTransaction()
+        self.counter += 1
+        self.txn = self.calendarStore.newTransaction(
+            self.id() + " (old #" + str(self.counter) + ")"
+        )
         self.home1 = self.txn.calendarHomeWithUID("home1")
         self.calendar1 = self.home1.calendarWithName("calendar_1")
 
@@ -312,11 +316,13 @@
             "sample.ics",
             VComponent.fromString(event4_text)
         )
+        self.txn.abort()
         self._refresh()
         self.assertIdentical(
             self.calendar1.calendarObjectWithName("sample.ics"),
             None
         )
+        self.txn.commit()
 
 
     def doThenUndo(self):
@@ -360,6 +366,7 @@
         Modifying a calendar object should cache the modified component in
         memory, to avoid unnecessary parsing round-trips.
         """
+        self.addCleanup(self.txn.commit)
         modifiedComponent = VComponent.fromString(event1modified_text)
         self.calendar1.calendarObjectWithName("1.ics").setComponent(
             modifiedComponent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100922/23978060/attachment.html>


More information about the calendarserver-changes mailing list