[CalendarServer-changes] [15752] CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Jul 7 09:34:19 PDT 2016


Revision: 15752
          http://trac.calendarserver.org//changeset/15752
Author:   cdaboo at apple.com
Date:     2016-07-07 09:34:18 -0700 (Thu, 07 Jul 2016)
Log Message:
-----------
Remove garbage collection checks as they are not reliable.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py

Modified: CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py	2016-07-07 16:26:06 UTC (rev 15751)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py	2016-07-07 16:34:18 UTC (rev 15752)
@@ -52,8 +52,7 @@
 from txdav.caldav.datastore.scheduling.itip import iTIPRequestStatus
 from txdav.caldav.datastore.scheduling.processing import ImplicitProcessor
 from txdav.caldav.datastore.scheduling.scheduler import ScheduleResponseQueue
-from txdav.caldav.datastore.sql import CalendarStoreFeatures, CalendarObject, \
-    CalendarHome
+from txdav.caldav.datastore.sql import CalendarStoreFeatures, CalendarObject
 from txdav.common.datastore.sql import ECALENDARTYPE, CommonObjectResource, \
     CommonStoreTransactionMonitor
 from txdav.common.datastore.sql_tables import schema, _BIND_MODE_DIRECT, \
@@ -79,7 +78,6 @@
 from twext.enterprise.util import parseSQLTimestamp
 
 import datetime
-import gc
 import os
 
 
@@ -7819,19 +7817,24 @@
         txn = None
         yield self.commit()
 
+        # This does not work reliably as a way to check whether the objects are
+        # gone as other things can hold on to a few (e.g. inlineCallbacks,
+        # tracebacks in deferred etc). For now this is commented out until a
+        # better solution can be used.
+
         # Garbage collect then look for the number of home/resource objects and
         # make sure only those for user01 still exist
-        gc.collect()
-        gcobjs = gc.get_objects()
-        hcount = 0
-        ocount = 0
-        for obj in gcobjs:
-            if isinstance(obj, CalendarHome):
-                hcount += 1
-            elif isinstance(obj, CalendarObject):
-                ocount += 1
-        self.assertTrue(hcount <= 2) # Just user01 home left (maybe user05 too)
-        self.assertTrue(ocount <= 4) # Old resource + new resource (and maybe user05 too)
+#        gc.collect()
+#        gcobjs = gc.get_objects()
+#        hcount = 0
+#        ocount = 0
+#        for obj in gcobjs:
+#            if isinstance(obj, CalendarHome):
+#                hcount += 1
+#            elif isinstance(obj, CalendarObject):
+#                ocount += 1
+#        self.assertTrue(hcount <= 2) # Just user01 home left (maybe user05 too)
+#        self.assertTrue(ocount <= 4) # Old resource + new resource (and maybe user05 too)
 
 
     @inlineCallbacks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20160707/8acd871b/attachment-0001.html>


More information about the calendarserver-changes mailing list