[CalendarServer-changes] [3403] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Nov 20 11:46:13 PST 2008


Revision: 3403
          http://trac.macosforge.org/projects/calendarserver/changeset/3403
Author:   cdaboo at apple.com
Date:     2008-11-20 11:46:13 -0800 (Thu, 20 Nov 2008)
Log Message:
-----------
Need to disable memcached client/server in config when doing tests as we can't run memcached during
the unit tests themselves.

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/test/test_tap.py
    CalendarServer/trunk/twistedcaldav/directory/test/test_digest.py
    CalendarServer/trunk/twistedcaldav/directory/test/test_opendirectoryrecords.py
    CalendarServer/trunk/twistedcaldav/directory/test/test_opendirectoryschema.py
    CalendarServer/trunk/twistedcaldav/directory/test/util.py
    CalendarServer/trunk/twistedcaldav/test/test_cache.py
    CalendarServer/trunk/twistedcaldav/test/test_config.py
    CalendarServer/trunk/twistedcaldav/test/test_localization.py
    CalendarServer/trunk/twistedcaldav/test/test_log.py
    CalendarServer/trunk/twistedcaldav/test/test_mail.py
    CalendarServer/trunk/twistedcaldav/test/test_memcache.py
    CalendarServer/trunk/twistedcaldav/test/test_memcachelock.py
    CalendarServer/trunk/twistedcaldav/test/test_memcachepool.py
    CalendarServer/trunk/twistedcaldav/test/test_memcacher.py
    CalendarServer/trunk/twistedcaldav/test/test_notify.py
    CalendarServer/trunk/twistedcaldav/test/test_resource.py
    CalendarServer/trunk/twistedcaldav/test/test_static.py
    CalendarServer/trunk/twistedcaldav/test/test_upgrade.py
    CalendarServer/trunk/twistedcaldav/test/util.py

Modified: CalendarServer/trunk/calendarserver/test/test_tap.py
===================================================================
--- CalendarServer/trunk/calendarserver/test/test_tap.py	2008-11-20 18:43:50 UTC (rev 3402)
+++ CalendarServer/trunk/calendarserver/test/test_tap.py	2008-11-20 19:46:13 UTC (rev 3403)
@@ -21,10 +21,7 @@
 except ImportError:
     from twistedcaldav.py.plistlib import writePlist
 
-from twisted.trial import unittest
-
 from twisted.python.usage import Options, UsageError
-from twisted.python.util import sibpath
 from twisted.python.reflect import namedAny
 from twisted.application.service import IService
 from twisted.application import internet
@@ -37,6 +34,7 @@
 from twistedcaldav.directory.aggregate import AggregateDirectoryService
 from twistedcaldav.directory.sudo import SudoDirectoryService
 from twistedcaldav.directory.directory import UnknownRecordTypeError
+from twistedcaldav.test.util import TestCase
 
 from calendarserver.tap.caldav import CalDAVOptions, CalDAVServiceMaker, CalDAVService
 
@@ -45,14 +43,14 @@
     A fake implementation of CalDAVOptions that provides
     empty implementations of checkDirectory and checkFile.
     """
-    def checkDirectory(*args, **kwargs):
+    def checkDirectory(self, *args, **kwargs):
         pass
 
-    def checkFile(*args, **kwargs):
+    def checkFile(self, *args, **kwargs):
         pass
 
 
-class CalDAVOptionsTest (unittest.TestCase):
+class CalDAVOptionsTest (TestCase):
     """
     Test various parameters of our usage.Options subclass
     """
@@ -61,6 +59,7 @@
         Set up our options object, giving it a parent, and forcing the
         global config to be loaded from defaults.
         """
+        TestCase.setUp(self)
         self.config = TestCalDAVOptions()
         self.config.parent = Options()
         self.config.parent["uid"] = 0
@@ -161,13 +160,14 @@
 
         self.assertEquals(config.MultiProcess["ProcessCount"], 102)
 
-class BaseServiceMakerTests(unittest.TestCase):
+class BaseServiceMakerTests(TestCase):
     """
     Utility class for ServiceMaker tests.
     """
     configOptions = None
 
     def setUp(self):
+        TestCase.setUp(self)
         self.options = TestCalDAVOptions()
         self.options.parent = Options()
         self.options.parent["gid"] = None

Modified: CalendarServer/trunk/twistedcaldav/directory/test/test_digest.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/test/test_digest.py	2008-11-20 18:43:50 UTC (rev 3402)
+++ CalendarServer/trunk/twistedcaldav/directory/test/test_digest.py	2008-11-20 19:46:13 UTC (rev 3403)
@@ -2,12 +2,12 @@
 
 from twisted.cred import error
 from twisted.internet import address
-from twisted.trial import unittest
 from twisted.web2.auth import digest
 from twisted.web2.auth.wrapper import UnauthorizedResponse
 from twisted.web2.test.test_server import SimpleRequest
 from twisted.web2.dav.fileop import rmdir
 from twistedcaldav.directory.digest import QopDigestCredentialFactory
+from twistedcaldav.test.util import TestCase
 import os
 import md5
 
@@ -71,7 +71,7 @@
 emtpyAttributeAuthRequest = 'realm="",nonce="doesn\'t matter"'
 
 
-class DigestAuthTestCase(unittest.TestCase):
+class DigestAuthTestCase(TestCase):
     """
     Test the behavior of DigestCredentialFactory
     """
@@ -80,6 +80,7 @@
         """
         Create a DigestCredentialFactory for testing
         """
+        TestCase.setUp(self)
         self.path1 = self.mktemp()
         self.path2 = self.mktemp()
         os.mkdir(self.path1)
@@ -392,7 +393,7 @@
 
             factory.invalidate(factory.generateNonce())
             response = UnauthorizedResponse({"Digest":factory}, request.remoteAddr)
-            wwwhdrs = response.headers.getHeader("www-authenticate")[0][1]
+            response.headers.getHeader("www-authenticate")[0][1]
 
     def test_incompatibleClientIp(self):
         """

Modified: CalendarServer/trunk/twistedcaldav/directory/test/test_opendirectoryrecords.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/test/test_opendirectoryrecords.py	2008-11-20 18:43:50 UTC (rev 3402)
+++ CalendarServer/trunk/twistedcaldav/directory/test/test_opendirectoryrecords.py	2008-11-20 19:46:13 UTC (rev 3403)
@@ -14,8 +14,8 @@
 # limitations under the License.
 ##
 
-import twisted.trial.unittest
 from uuid import uuid4
+from twistedcaldav.test.util import TestCase
 
 try:
     from twistedcaldav.directory.appleopendirectory import OpenDirectoryService as RealOpenDirectoryService
@@ -27,9 +27,9 @@
     from twistedcaldav.directory.util import uuidFromName
 
     class OpenDirectoryService (RealOpenDirectoryService):
-        def _queryDirectory(directory, recordType, shortName=None, guid=None):
+        def _queryDirectory(self, recordType, shortName=None, guid=None):
             if shortName is None and guid is None:
-                return directory.fakerecords[recordType]
+                return self.fakerecords[recordType]
 
             assert shortName is None or guid is None
             if guid is not None:
@@ -37,13 +37,13 @@
 
             records = []
 
-            for name, record in directory.fakerecords[recordType]:
+            for name, record in self.fakerecords[recordType]:
                 if name == shortName or record[dsattributes.kDS1AttrGeneratedUID] == guid:
                     records.append((name, record))
 
             return tuple(records)
     
-    class ReloadCache(twisted.trial.unittest.TestCase):
+    class ReloadCache(TestCase):
         def setUp(self):
             super(ReloadCache, self).setUp()
             self._service = OpenDirectoryService(node="/Search", dosetup=False)

Modified: CalendarServer/trunk/twistedcaldav/directory/test/test_opendirectoryschema.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/test/test_opendirectoryschema.py	2008-11-20 18:43:50 UTC (rev 3402)
+++ CalendarServer/trunk/twistedcaldav/directory/test/test_opendirectoryschema.py	2008-11-20 19:46:13 UTC (rev 3403)
@@ -19,9 +19,9 @@
 except ImportError:
     pass
 else:
-    import twisted.trial.unittest
+    from twistedcaldav.test.util import TestCase
 
-    class ODResourceInfoParse (twisted.trial.unittest.TestCase):
+    class ODResourceInfoParse (TestCase):
 
         plist_good_false = """<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

Modified: CalendarServer/trunk/twistedcaldav/directory/test/util.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/test/util.py	2008-11-20 18:43:50 UTC (rev 3402)
+++ CalendarServer/trunk/twistedcaldav/directory/test/util.py	2008-11-20 19:46:13 UTC (rev 3403)
@@ -14,17 +14,17 @@
 # limitations under the License.
 ##
 
-import twisted.trial.unittest
 from twisted.trial.unittest import SkipTest
 from twisted.cred.credentials import UsernamePassword
 from twisted.web2.auth.digest import DigestedCredentials, calcResponse, calcHA1
 
 from twistedcaldav.directory.directory import DirectoryService
 from twistedcaldav.directory.directory import UnknownRecordTypeError
+from twistedcaldav.test.util import TestCase
 
 # FIXME: Add tests for GUID hooey, once we figure out what that means here
 
-class DirectoryTestCase (twisted.trial.unittest.TestCase):
+class DirectoryTestCase (TestCase):
     """
     Tests a directory implementation.
     """
@@ -209,7 +209,7 @@
         return names
 
     def allEntries(self):
-        for data, recordType in (
+        for data, _ignore_recordType in (
             (self.users,     DirectoryService.recordType_users    ),
             (self.groups,    DirectoryService.recordType_groups   ),
             (self.locations, DirectoryService.recordType_locations),

Modified: CalendarServer/trunk/twistedcaldav/test/test_cache.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_cache.py	2008-11-20 18:43:50 UTC (rev 3402)
+++ CalendarServer/trunk/twistedcaldav/test/test_cache.py	2008-11-20 19:46:13 UTC (rev 3403)
@@ -18,7 +18,6 @@
 import hashlib
 import cPickle
 
-from twisted.trial.unittest import TestCase
 from twisted.internet.defer import succeed, maybeDeferred
 
 from twisted.web2.dav import davxml
@@ -31,6 +30,7 @@
 from twistedcaldav.cache import PropfindCacheMixin
 
 from twistedcaldav.test.util import InMemoryMemcacheProtocol
+from twistedcaldav.test.util import TestCase
 
 
 def _newCacheToken(self):
@@ -87,6 +87,7 @@
 
 class MemCacheChangeNotifierTests(TestCase):
     def setUp(self):
+        TestCase.setUp(self)
         self.memcache = InMemoryMemcacheProtocol()
         self.ccn = MemcacheChangeNotifier(
             StubURLResource(':memory:'),
@@ -96,7 +97,6 @@
                                                  self.ccn,
                                                  MemcacheChangeNotifier)
 
-
     def assertToken(self, expectedToken):
         token = self.memcache._cache['cacheToken::memory:'][1]
         self.assertEquals(token, expectedToken)
@@ -361,7 +361,6 @@
 
         self.memcacheStub = memcacheStub
 
-
     def test_givenURIsForKeys(self):
         expected_response = (200, Headers({}), "Foobarbaz")
 
@@ -433,6 +432,7 @@
     Test the PropfindCacheMixin
     """
     def setUp(self):
+        TestCase.setUp(self)
         self.resource = TestCachingResource(StubResponse(200, {}, "foobar"))
         self.responseCache = StubResponseCacheResource()
 

Modified: CalendarServer/trunk/twistedcaldav/test/test_config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_config.py	2008-11-20 18:43:50 UTC (rev 3402)
+++ CalendarServer/trunk/twistedcaldav/test/test_config.py	2008-11-20 19:46:13 UTC (rev 3403)
@@ -19,11 +19,10 @@
 except ImportError:
     from twistedcaldav.py.plistlib import writePlist
 
-from twisted.trial import unittest
-
 from twistedcaldav.log import logLevelForNamespace
 from twistedcaldav.config import config, defaultConfig, ConfigurationError
 from twistedcaldav.static import CalDAVFile
+from twistedcaldav.test.util import TestCase
 
 testConfig = """<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@@ -49,12 +48,12 @@
 """
 
 def _testResponseCompression(testCase):
-    from twistedcaldav.config import config
     testCase.assertEquals(config.ResponseCompression, False)
 
 
-class ConfigTests(unittest.TestCase):
+class ConfigTests(TestCase):
     def setUp(self):
+        TestCase.setUp(self)
         config.update(defaultConfig)
         self.testConfig = self.mktemp()
         open(self.testConfig, "w").write(testConfig)

Modified: CalendarServer/trunk/twistedcaldav/test/test_localization.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_localization.py	2008-11-20 18:43:50 UTC (rev 3402)
+++ CalendarServer/trunk/twistedcaldav/test/test_localization.py	2008-11-20 19:46:13 UTC (rev 3403)
@@ -16,10 +16,10 @@
 
 from __future__ import with_statement
 
-from twisted.trial.unittest import TestCase
 from twistedcaldav.localization import translationTo
 from twistedcaldav.ical import Component
-from datetime import datetime, time
+from twistedcaldav.test.util import TestCase
+from datetime import time
 import os
 
 def getComp(str):

Modified: CalendarServer/trunk/twistedcaldav/test/test_log.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_log.py	2008-11-20 18:43:50 UTC (rev 3402)
+++ CalendarServer/trunk/twistedcaldav/test/test_log.py	2008-11-20 19:46:13 UTC (rev 3403)
@@ -15,10 +15,8 @@
 ##
 
 from twistedcaldav.log import *
-from twistedcaldav.log import logLevelsByNamespace
+from twistedcaldav.test.util import TestCase
 
-import twisted.trial.unittest
-
 defaultLogLevel = logLevelsByNamespace[None]
 
 class TestLogger (Logger):
@@ -37,7 +35,7 @@
 class LoggingEnabledObject (LoggingMixIn):
     pass
 
-class Logging (twisted.trial.unittest.TestCase):
+class Logging (TestCase):
     def test_cmpLogLevels(self):
         self.assertEquals(cmpLogLevels("info" , "error"), -1)
         self.assertEquals(cmpLogLevels("debug", "debug"),  0)

Modified: CalendarServer/trunk/twistedcaldav/test/test_mail.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_mail.py	2008-11-20 18:43:50 UTC (rev 3402)
+++ CalendarServer/trunk/twistedcaldav/test/test_mail.py	2008-11-20 19:46:13 UTC (rev 3403)
@@ -14,8 +14,8 @@
 # limitations under the License.
 ##
 
-from twisted.trial.unittest import TestCase
 from twistedcaldav.mail import *
+from twistedcaldav.test.util import TestCase
 import email
 import os
 
@@ -27,6 +27,7 @@
 class MailHandlerTests(TestCase):
 
     def setUp(self):
+        TestCase.setUp(self)
         self.handler = MailHandler(dataRoot=":memory:")
         self.dataDir = os.path.join(os.path.dirname(__file__), "data", "mail")
 
@@ -109,6 +110,7 @@
 class MailGatewayTokensDatabaseTests(TestCase):
 
     def setUp(self):
+        TestCase.setUp(self)
         self.db = MailGatewayTokensDatabase(":memory:")
 
     def test_tokens(self):

Modified: CalendarServer/trunk/twistedcaldav/test/test_memcache.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_memcache.py	2008-11-20 18:43:50 UTC (rev 3402)
+++ CalendarServer/trunk/twistedcaldav/test/test_memcache.py	2008-11-20 19:46:13 UTC (rev 3403)
@@ -8,13 +8,11 @@
 from twistedcaldav.memcache import MemCacheProtocol, NoSuchCommand
 from twistedcaldav.memcache import ClientError, ServerError
 
-from twisted.trial.unittest import TestCase
 from twisted.test.proto_helpers import StringTransportWithDisconnection
 from twisted.internet.task import Clock
 from twisted.internet.defer import Deferred, gatherResults, TimeoutError
+from twistedcaldav.test.util import TestCase
 
-
-
 class MemCacheTestCase(TestCase):
     """
     Test client protocol class L{MemCacheProtocol}.
@@ -25,6 +23,7 @@
         Create a memcache client, connect it to a string protocol, and make it
         use a deterministic clock.
         """
+        TestCase.setUp(self)
         self.proto = MemCacheProtocol()
         self.clock = Clock()
         self.proto.callLater = self.clock.callLater
@@ -32,7 +31,6 @@
         self.transport.protocol = self.proto
         self.proto.makeConnection(self.transport)
 
-
     def _test(self, d, send, recv, result):
         """
         Shortcut method for classic tests.
@@ -306,7 +304,7 @@
         def check(result):
             self.assertEquals(result, (0, "bar"))
             self.assertEquals(len(self.clock.calls), 1)
-            for i in range(self.proto.persistentTimeOut):
+            for _ignore in range(self.proto.persistentTimeOut):
                 self.clock.advance(1)
             return self.assertFailure(d2, TimeoutError).addCallback(checkTime)
         def checkTime(ignored):

Modified: CalendarServer/trunk/twistedcaldav/test/test_memcachelock.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_memcachelock.py	2008-11-20 18:43:50 UTC (rev 3402)
+++ CalendarServer/trunk/twistedcaldav/test/test_memcachelock.py	2008-11-20 19:46:13 UTC (rev 3403)
@@ -8,11 +8,11 @@
 from twistedcaldav.memcache import MemCacheProtocol
 from twistedcaldav.memcachelock import MemcacheLock, MemcacheLockTimeoutError
 
-from twisted.trial.unittest import TestCase
 from twisted.test.proto_helpers import StringTransportWithDisconnection
 from twisted.internet.task import Clock
 from twisted.internet.defer import inlineCallbacks
 
+from twistedcaldav.test.util import TestCase
 
 class MemCacheTestCase(TestCase):
     """
@@ -48,6 +48,7 @@
         Create a memcache client, connect it to a string protocol, and make it
         use a deterministic clock.
         """
+        TestCase.setUp(self)
         self.proto = MemCacheProtocol()
         self.clock = Clock()
         self.proto.callLater = self.clock.callLater

Modified: CalendarServer/trunk/twistedcaldav/test/test_memcachepool.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_memcachepool.py	2008-11-20 18:43:50 UTC (rev 3402)
+++ CalendarServer/trunk/twistedcaldav/test/test_memcachepool.py	2008-11-20 19:46:13 UTC (rev 3403)
@@ -16,8 +16,6 @@
 
 from zope.interface import implements
 
-from twisted.trial.unittest import TestCase
-
 from twisted.internet.interfaces import IConnector, IReactorTCP
 from twisted.internet.address import IPv4Address
 
@@ -26,6 +24,7 @@
 from twistedcaldav.memcachepool import MemCacheClientFactory
 from twistedcaldav.memcachepool import MemCachePool
 
+from twistedcaldav.test.util import TestCase
 
 MC_ADDRESS = IPv4Address('TCP', '127.0.0.1', 11211)
 
@@ -137,12 +136,12 @@
         Create a L{MemCacheClientFactory} instance and and give it a
         L{StubConnectionPool} instance.
         """
+        super(MemCacheClientFactoryTests, self).setUp()
         self.pool = StubConnectionPool()
         self.factory = MemCacheClientFactory()
         self.factory.connectionPool = self.pool
         self.protocol = self.factory.buildProtocol(None)
 
-
     def test_clientConnectionFailedNotifiesPool(self):
         """
         Test that L{MemCacheClientFactory.clientConnectionFailed} notifies
@@ -171,7 +170,7 @@
         This will happen when we get reconnected.  We'll remove the old protocol
         and add a new one.
         """
-        protocol = self.factory.buildProtocol(None)
+        self.factory.buildProtocol(None)
         self.assertEquals(self.factory.connectionPool.calls,
                           [('gone', self.protocol)])
 
@@ -196,12 +195,12 @@
         """
         Create a L{MemCachePool}.
         """
+        TestCase.setUp(self)
         self.reactor = StubReactor()
         self.pool = MemCachePool(MC_ADDRESS,
                                  maxClients=5,
                                  reactor=self.reactor)
 
-
     def test_clientFreeAddsNewClient(self):
         """
         Test that a client not in the busy set gets added to the free set.
@@ -398,7 +397,7 @@
         self.failUnless(isinstance(args[2], MemCacheClientFactory))
         self.assertEquals(kwargs, {})
 
-        d1 = self.pool.performRequest('get', 'bar')
+        self.pool.performRequest('get', 'bar')
         self.assertEquals(self.reactor.calls, [])
 
         args[2].deferred.callback(InMemoryMemcacheProtocol())

Modified: CalendarServer/trunk/twistedcaldav/test/test_memcacher.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_memcacher.py	2008-11-20 18:43:50 UTC (rev 3402)
+++ CalendarServer/trunk/twistedcaldav/test/test_memcacher.py	2008-11-20 19:46:13 UTC (rev 3403)
@@ -6,10 +6,10 @@
 """
 
 from twisted.internet.defer import inlineCallbacks
-from twisted.trial.unittest import TestCase
 
 from twistedcaldav.config import config
 from twistedcaldav.memcacher import Memcacher
+from twistedcaldav.test.util import TestCase
 
 class MemcacherTestCase(TestCase):
     """

Modified: CalendarServer/trunk/twistedcaldav/test/test_notify.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_notify.py	2008-11-20 18:43:50 UTC (rev 3402)
+++ CalendarServer/trunk/twistedcaldav/test/test_notify.py	2008-11-20 19:46:13 UTC (rev 3403)
@@ -14,13 +14,13 @@
 # limitations under the License.
 ##
 
-from twisted.trial.unittest import TestCase
 from twisted.internet.task import Clock
 from twisted.words.protocols.jabber.client import IQ
 from twisted.words.protocols.jabber.error import StanzaError
 from twistedcaldav.notify import *
 from twistedcaldav import config as config_mod
 from twistedcaldav.config import Config
+from twistedcaldav.test.util import TestCase
 
 
 class StubResource(object):
@@ -53,6 +53,7 @@
 class NotificationClientFactoryTests(TestCase):
 
     def setUp(self):
+        TestCase.setUp(self)
         self.client = StubNotificationClient(None, None)
         self.factory = NotificationClientFactory(self.client)
         self.factory.protocol = StubNotificationClientProtocol
@@ -107,6 +108,7 @@
 class NotificationClientTests(TestCase):
 
     def setUp(self):
+        TestCase.setUp(self)
         self.client = NotificationClient(None, None, reactor=Clock())
         self.client.factory = StubNotificationClientFactory()
 
@@ -145,6 +147,7 @@
 class CoalescerTests(TestCase):
 
     def setUp(self):
+        TestCase.setUp(self)
         self.clock = Clock()
         self.notifier = StubNotifier()
         self.coalescer = Coalescer([self.notifier], reactor=self.clock)
@@ -185,6 +188,7 @@
 class SimpleLineNotifierTests(TestCase):
 
     def setUp(self):
+        TestCase.setUp(self)
         self.clock = Clock()
         self.notifier = SimpleLineNotifier(None)
         self.coalescer = Coalescer([self.notifier], reactor=self.clock)
@@ -276,6 +280,7 @@
 class SimpleLineNotificationProtocolTests(TestCase):
 
     def setUp(self):
+        TestCase.setUp(self)
         self.notifier = StubNotifier()
         self.protocol = SimpleLineNotificationProtocol()
         self.protocol.notifier = self.notifier
@@ -323,10 +328,10 @@
     def send(self, element):
         self.elements.append(element)
 
-    def addOnetimeObserver(*args, **kwds):
+    def addOnetimeObserver(self, *args, **kwds):
         pass
 
-    def addObserver(*args, **kwds):
+    def addObserver(self, *args, **kwds):
         pass
 
 
@@ -346,6 +351,7 @@
     xmppDisabledConfig.Notifications['Services']['XMPPNotifier']['Enabled'] = False
 
     def setUp(self):
+        TestCase.setUp(self)
         self.xmlStream = StubXmlStream()
         self.settings = { 'ServiceAddress' : 'pubsub.example.com',
             'NodeConfiguration' : { 'pubsub#deliver_payloads' : '1' },

Modified: CalendarServer/trunk/twistedcaldav/test/test_resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_resource.py	2008-11-20 18:43:50 UTC (rev 3402)
+++ CalendarServer/trunk/twistedcaldav/test/test_resource.py	2008-11-20 19:46:13 UTC (rev 3403)
@@ -14,11 +14,10 @@
 # limitations under the License.
 ##
 
-from twisted.trial.unittest import TestCase
-
 from twistedcaldav.resource import CalDAVResource
 
 from twistedcaldav.test.util import InMemoryPropertyStore
+from twistedcaldav.test.util import TestCase
 
 
 class StubProperty(object):
@@ -28,6 +27,7 @@
 
 class CalDAVResourceTests(TestCase):
     def setUp(self):
+        TestCase.setUp(self)
         self.resource = CalDAVResource()
         self.resource._dead_properties = InMemoryPropertyStore()
 

Modified: CalendarServer/trunk/twistedcaldav/test/test_static.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_static.py	2008-11-20 18:43:50 UTC (rev 3402)
+++ CalendarServer/trunk/twistedcaldav/test/test_static.py	2008-11-20 19:46:13 UTC (rev 3403)
@@ -14,11 +14,10 @@
 # limitations under the License.
 ##
 
-from twisted.trial.unittest import TestCase
-
 from twistedcaldav.static import CalendarHomeFile, CalDAVFile
 from twistedcaldav.cache import DisabledCacheNotifier
 from twistedcaldav.test.util import StubCacheChangeNotifier
+from twistedcaldav.test.util import TestCase
 
 class StubParentResource(object):
     def principalCollections(self):
@@ -27,6 +26,7 @@
 
 class CalendarHomeFileTests(TestCase):
     def setUp(self):
+        TestCase.setUp(self)
         self.calendarHome = CalendarHomeFile(self.mktemp(),
                                              StubParentResource(),
                                              object())
@@ -44,6 +44,7 @@
 
 class CalDAVFileTests(TestCase):
     def setUp(self):
+        TestCase.setUp(self)
         self.caldavFile = CalDAVFile(self.mktemp())
         self.caldavFile.fp.createDirectory()
         self.caldavFile.cacheNotifier = StubCacheChangeNotifier()

Modified: CalendarServer/trunk/twistedcaldav/test/test_upgrade.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_upgrade.py	2008-11-20 18:43:50 UTC (rev 3402)
+++ CalendarServer/trunk/twistedcaldav/test/test_upgrade.py	2008-11-20 19:46:13 UTC (rev 3403)
@@ -14,12 +14,11 @@
 # limitations under the License.
 ##
 
-from twisted.trial.unittest import TestCase
-
 from twistedcaldav.config import config
 from twistedcaldav.directory.calendaruserproxy import CalendarUserProxyDatabase
 from twistedcaldav.upgrade import UpgradeError
 from twistedcaldav.upgrade import UpgradeTheServer
+from twistedcaldav.test.util import TestCase
 
 import os
 

Modified: CalendarServer/trunk/twistedcaldav/test/util.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/util.py	2008-11-20 18:43:50 UTC (rev 3402)
+++ CalendarServer/trunk/twistedcaldav/test/util.py	2008-11-20 19:46:13 UTC (rev 3403)
@@ -35,8 +35,9 @@
         dataroot = self.mktemp()
         os.mkdir(dataroot)
         config.DataRoot = dataroot
+        config.Memcached.ClientEnabled = False
+        config.Memcached.ServerEnabled = False
 
-
 class InMemoryPropertyStore(object):
     def __init__(self):
         class _FauxPath(object):
@@ -113,7 +114,7 @@
 
             return succeed(True)
 
-        except Exception, err:
+        except Exception:
             return fail(Failure())
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081120/18d0a016/attachment-0001.html>


More information about the calendarserver-changes mailing list