[CalendarServer-changes] [7450] CalendarServer/branches/users/glyph/new-export
source_changes at macosforge.org
source_changes at macosforge.org
Mon May 16 07:41:09 PDT 2011
Revision: 7450
http://trac.macosforge.org/projects/calendarserver/changeset/7450
Author: glyph at apple.com
Date: 2011-05-16 07:41:09 -0700 (Mon, 16 May 2011)
Log Message:
-----------
Clean up redundant memcache per-test disabling; it's always called when it's time to call buildStore, and it's only called when it's time to call buildStore, so just put it into buildStore and forget it.
Modified Paths:
--------------
CalendarServer/branches/users/glyph/new-export/calendarserver/tools/test/test_purge_old_events.py
CalendarServer/branches/users/glyph/new-export/twistedcaldav/test/test_calendarquery.py
CalendarServer/branches/users/glyph/new-export/twistedcaldav/test/test_sharing.py
CalendarServer/branches/users/glyph/new-export/twistedcaldav/test/test_wrapping.py
CalendarServer/branches/users/glyph/new-export/txdav/base/propertystore/test/test_sql.py
CalendarServer/branches/users/glyph/new-export/txdav/caldav/datastore/test/test_sql.py
CalendarServer/branches/users/glyph/new-export/txdav/carddav/datastore/test/test_sql.py
CalendarServer/branches/users/glyph/new-export/txdav/common/datastore/test/test_util.py
CalendarServer/branches/users/glyph/new-export/txdav/common/datastore/test/util.py
Modified: CalendarServer/branches/users/glyph/new-export/calendarserver/tools/test/test_purge_old_events.py
===================================================================
--- CalendarServer/branches/users/glyph/new-export/calendarserver/tools/test/test_purge_old_events.py 2011-05-16 14:40:56 UTC (rev 7449)
+++ CalendarServer/branches/users/glyph/new-export/calendarserver/tools/test/test_purge_old_events.py 2011-05-16 14:41:09 UTC (rev 7450)
@@ -26,7 +26,6 @@
from twisted.trial import unittest
from twistedcaldav.config import config
-from twistedcaldav.memcacher import Memcacher
from twistedcaldav.vcard import Component as VCardComponent
from txdav.common.datastore.test.util import buildStore, populateCalendarsFrom, CommonCommonTests
@@ -348,9 +347,6 @@
@inlineCallbacks
def setUp(self):
- self.patch(config.Memcached.Pools.Default, "ClientEnabled", False)
- self.patch(config.Memcached.Pools.Default, "ServerEnabled", False)
- self.patch(Memcacher, "allowTestCache", True)
yield super(PurgeOldEventsTests, self).setUp()
self._sqlCalendarStore = yield buildStore(self, self.notifierFactory)
yield self.populate()
Modified: CalendarServer/branches/users/glyph/new-export/twistedcaldav/test/test_calendarquery.py
===================================================================
--- CalendarServer/branches/users/glyph/new-export/twistedcaldav/test/test_calendarquery.py 2011-05-16 14:40:56 UTC (rev 7449)
+++ CalendarServer/branches/users/glyph/new-export/twistedcaldav/test/test_calendarquery.py 2011-05-16 14:41:09 UTC (rev 7450)
@@ -34,7 +34,6 @@
from twistedcaldav.config import config
from twistedcaldav.test.util import HomeTestCase
from twisted.internet.defer import inlineCallbacks, returnValue
-from twistedcaldav.memcacher import Memcacher
from txdav.common.datastore.test.util import buildStore, StubNotifierFactory
@@ -355,9 +354,6 @@
@inlineCallbacks
def setUp(self):
- self.patch(config.Memcached.Pools.Default, "ClientEnabled", False)
- self.patch(config.Memcached.Pools.Default, "ServerEnabled", False)
- self.patch(Memcacher, "allowTestCache", True)
self.calendarStore = yield buildStore(self, StubNotifierFactory())
yield super(DatabaseQueryTests, self).setUp()
Modified: CalendarServer/branches/users/glyph/new-export/twistedcaldav/test/test_sharing.py
===================================================================
--- CalendarServer/branches/users/glyph/new-export/twistedcaldav/test/test_sharing.py 2011-05-16 14:40:56 UTC (rev 7449)
+++ CalendarServer/branches/users/glyph/new-export/twistedcaldav/test/test_sharing.py 2011-05-16 14:41:09 UTC (rev 7450)
@@ -24,7 +24,7 @@
from twistedcaldav import customxml
from twistedcaldav.config import config
from twistedcaldav.test.util import HomeTestCase, norequest
-from twistedcaldav.memcacher import Memcacher
+
from twistedcaldav.resource import CalDAVResource
from txdav.common.datastore.test.util import buildStore, StubNotifierFactory
@@ -547,9 +547,6 @@
@inlineCallbacks
def setUp(self):
- self.patch(config.Memcached.Pools.Default, "ClientEnabled", False)
- self.patch(config.Memcached.Pools.Default, "ServerEnabled", False)
- self.patch(Memcacher, "allowTestCache", True)
self.calendarStore = yield buildStore(self, StubNotifierFactory())
yield super(DatabaseSharingTests, self).setUp()
Modified: CalendarServer/branches/users/glyph/new-export/twistedcaldav/test/test_wrapping.py
===================================================================
--- CalendarServer/branches/users/glyph/new-export/twistedcaldav/test/test_wrapping.py 2011-05-16 14:40:56 UTC (rev 7449)
+++ CalendarServer/branches/users/glyph/new-export/twistedcaldav/test/test_wrapping.py 2011-05-16 14:41:09 UTC (rev 7450)
@@ -46,7 +46,6 @@
StubNotifierFactory
-from twistedcaldav.memcacher import Memcacher
from txdav.caldav.icalendarstore import ICalendarHome
from txdav.carddav.iaddressbookstore import IAddressBookHome
@@ -470,9 +469,6 @@
@inlineCallbacks
def setUp(self):
- self.patch(config.Memcached.Pools.Default, "ClientEnabled", False)
- self.patch(config.Memcached.Pools.Default, "ServerEnabled", False)
- self.patch(Memcacher, "allowTestCache", True)
self.calendarStore = yield buildStore(self, StubNotifierFactory())
super(DatabaseWrappingTests, self).setUp()
Modified: CalendarServer/branches/users/glyph/new-export/txdav/base/propertystore/test/test_sql.py
===================================================================
--- CalendarServer/branches/users/glyph/new-export/txdav/base/propertystore/test/test_sql.py 2011-05-16 14:40:56 UTC (rev 7449)
+++ CalendarServer/branches/users/glyph/new-export/txdav/base/propertystore/test/test_sql.py 2011-05-16 14:41:09 UTC (rev 7450)
@@ -26,10 +26,8 @@
from txdav.base.propertystore.test.base import (
PropertyStoreTest, propertyName, propertyValue)
-from twistedcaldav import memcacher
from twisted.internet.defer import gatherResults
from twext.enterprise.ienterprise import AlreadyFinishedError
-from twistedcaldav.config import config
try:
from txdav.base.propertystore.sql import PropertyStore
@@ -45,10 +43,6 @@
@inlineCallbacks
def setUp(self):
- self.patch(config.Memcached.Pools.Default, "ClientEnabled", False)
- self.patch(config.Memcached.Pools.Default, "ServerEnabled", False)
- self.patch(memcacher.Memcacher, "allowTestCache", True)
-
self.notifierFactory = StubNotifierFactory()
self.store = yield buildStore(self, self.notifierFactory)
self.addCleanup(self.maybeCommitLast)
Modified: CalendarServer/branches/users/glyph/new-export/txdav/caldav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/branches/users/glyph/new-export/txdav/caldav/datastore/test/test_sql.py 2011-05-16 14:40:56 UTC (rev 7449)
+++ CalendarServer/branches/users/glyph/new-export/txdav/caldav/datastore/test/test_sql.py 2011-05-16 14:41:09 UTC (rev 7450)
@@ -38,8 +38,8 @@
from txdav.common.datastore.sql_tables import schema
from txdav.common.datastore.test.util import buildStore, populateCalendarsFrom
-from twistedcaldav import memcacher, caldavxml
-from twistedcaldav.config import config
+from twistedcaldav import caldavxml
+
from twistedcaldav.dateops import datetimeMktime
from twistedcaldav.sharing import SharedCollectionRecord
@@ -52,10 +52,6 @@
@inlineCallbacks
def setUp(self):
- self.patch(config.Memcached.Pools.Default, "ClientEnabled", False)
- self.patch(config.Memcached.Pools.Default, "ServerEnabled", False)
- self.patch(memcacher.Memcacher, "allowTestCache", True)
-
yield super(CalendarSQLStorageTests, self).setUp()
self._sqlCalendarStore = yield buildStore(self, self.notifierFactory)
yield self.populate()
Modified: CalendarServer/branches/users/glyph/new-export/txdav/carddav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/branches/users/glyph/new-export/txdav/carddav/datastore/test/test_sql.py 2011-05-16 14:40:56 UTC (rev 7449)
+++ CalendarServer/branches/users/glyph/new-export/txdav/carddav/datastore/test/test_sql.py 2011-05-16 14:41:09 UTC (rev 7450)
@@ -25,8 +25,8 @@
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.trial import unittest
-from twistedcaldav import memcacher, carddavxml
-from twistedcaldav.config import config
+from twistedcaldav import carddavxml
+
from twistedcaldav.vcard import Component as VCard
from twistedcaldav.vcard import Component as VComponent
@@ -47,10 +47,6 @@
@inlineCallbacks
def setUp(self):
- self.patch(config.Memcached.Pools.Default, "ClientEnabled", False)
- self.patch(config.Memcached.Pools.Default, "ServerEnabled", False)
- self.patch(memcacher.Memcacher, "allowTestCache", True)
-
yield super(AddressBookSQLStorageTests, self).setUp()
self._sqlStore = yield buildStore(self, self.notifierFactory)
yield self.populate()
Modified: CalendarServer/branches/users/glyph/new-export/txdav/common/datastore/test/test_util.py
===================================================================
--- CalendarServer/branches/users/glyph/new-export/txdav/common/datastore/test/test_util.py 2011-05-16 14:40:56 UTC (rev 7449)
+++ CalendarServer/branches/users/glyph/new-export/txdav/common/datastore/test/test_util.py 2011-05-16 14:41:09 UTC (rev 7450)
@@ -26,9 +26,6 @@
from twisted.internet.protocol import Protocol
from twisted.trial.unittest import TestCase
-from twistedcaldav.config import config
-from twistedcaldav.memcacher import Memcacher
-
from txdav.caldav.datastore.test.common import CommonTests
from txdav.carddav.datastore.test.common import CommonTests as ABCommonTests
from txdav.common.datastore.file import CommonDataStore
@@ -48,9 +45,7 @@
Set up two stores to migrate between.
"""
# Add some files to the file store.
- self.patch(config.Memcached.Pools.Default, "ClientEnabled", False)
- self.patch(config.Memcached.Pools.Default, "ServerEnabled", False)
- self.patch(Memcacher, "allowTestCache", True)
+
self.filesPath = CachingFilePath(self.mktemp())
self.filesPath.createDirectory()
fileStore = self.fileStore = CommonDataStore(
Modified: CalendarServer/branches/users/glyph/new-export/txdav/common/datastore/test/util.py
===================================================================
--- CalendarServer/branches/users/glyph/new-export/txdav/common/datastore/test/util.py 2011-05-16 14:40:56 UTC (rev 7449)
+++ CalendarServer/branches/users/glyph/new-export/txdav/common/datastore/test/util.py 2011-05-16 14:41:09 UTC (rev 7450)
@@ -76,6 +76,7 @@
@return: a L{Deferred} which fires with an L{IDataStore}.
"""
+ disableMemcacheForTest(testCase)
dbRoot = CachingFilePath(self.SHARED_DB_PATH)
attachmentRoot = dbRoot.child("attachments")
if self.sharedService is None:
@@ -423,3 +424,24 @@
def reset(self):
self.history = []
+
+
+
+def disableMemcacheForTest(aTest):
+ """
+ Disable all memcache logic for the duration of a test; we shouldn't be
+ starting or connecting to any memcache stuff for most tests.
+ """
+
+ # These imports are local so that they don't accidentally leak to anything
+ # else in this module; nothing else in this module should ever touch global
+ # configuration. -glyph
+
+ from twistedcaldav import config
+ from twistedcaldav.memcacher import Memcacher
+
+ aTest.patch(config.Memcached.Pools.Default, "ClientEnabled", False)
+ aTest.patch(config.Memcached.Pools.Default, "ServerEnabled", False)
+ aTest.patch(Memcacher, "allowTestCache", True)
+
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110516/3ae3e081/attachment-0001.html>
More information about the calendarserver-changes
mailing list