[Checkins]
SVN: gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/
Fixed coding style
Dirceu Pereira Tiegs
dirceutiegs at gmail.com
Tue Jun 24 07:35:34 EDT 2008
Log message for revision 87703:
Fixed coding style
Changed:
U gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/component.xml
D gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/dumbstorage.py
A gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/loggingstorage.py
U gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/test_basics.py
-=-
Modified: gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/component.xml
===================================================================
--- gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/component.xml 2008-06-24 10:45:26 UTC (rev 87702)
+++ gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/component.xml 2008-06-24 11:35:33 UTC (rev 87703)
@@ -18,9 +18,9 @@
</sectiontype>
<sectiontype
- name="dumbstorage"
+ name="loggingstorage"
implements="ZODB.storage"
- datatype=".dumbstorage.Opener">
+ datatype=".loggingstorage.Opener">
<key name="name" default="Demo Storage"/>
<section type="ZODB.storage" name="*" attribute="base"/>
Deleted: gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/dumbstorage.py
===================================================================
--- gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/dumbstorage.py 2008-06-24 10:45:26 UTC (rev 87702)
+++ gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/dumbstorage.py 2008-06-24 11:35:33 UTC (rev 87703)
@@ -1,39 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2007-2008 Zope Foundation and contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Unit test support."""
-
-import ZODB.DemoStorage
-import ZODB.config
-
-
-class Opener(ZODB.config.BaseConfig):
-
- def open(self):
- name = self.config.name
- return DumbStorage(name)
-
-
-class DumbStorage(ZODB.DemoStorage.DemoStorage):
-
- def __init__(self, name=''):
- ZODB.DemoStorage.DemoStorage.__init__(self)
- self._name = name
- self._log = []
-
- def getSize(self):
- self._log.append("Storage '%s' called." % self._name)
- ZODB.DemoStorage.DemoStorage.getSize(self)
-
- def supportsUndo(self):
- return True
\ No newline at end of file
Copied: gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/loggingstorage.py (from rev 87696, gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/dumbstorage.py)
===================================================================
--- gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/loggingstorage.py (rev 0)
+++ gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/loggingstorage.py 2008-06-24 11:35:33 UTC (rev 87703)
@@ -0,0 +1,41 @@
+##############################################################################
+#
+# Copyright (c) 2007-2008 Zope Foundation and contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""LoggingStorage is a storage used for testing purposes that logs calls made
+ to an arbitrary method (getSize()).
+"""
+
+import ZODB.DemoStorage
+import ZODB.config
+
+
+class Opener(ZODB.config.BaseConfig):
+
+ def open(self):
+ name = self.config.name
+ return LoggingStorage(name)
+
+
+class LoggingStorage(ZODB.DemoStorage.DemoStorage):
+
+ def __init__(self, name=''):
+ ZODB.DemoStorage.DemoStorage.__init__(self)
+ self._name = name
+ self._log = []
+
+ def getSize(self):
+ self._log.append("Storage '%s' called." % self._name)
+ return ZODB.DemoStorage.DemoStorage.getSize(self)
+
+ def supportsUndo(self):
+ return True
\ No newline at end of file
Modified: gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/test_basics.py
===================================================================
--- gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/test_basics.py 2008-06-24 10:45:26 UTC (rev 87702)
+++ gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/test_basics.py 2008-06-24 11:35:33 UTC (rev 87703)
@@ -35,7 +35,7 @@
import gocept.zeoraid.storage
import gocept.zeoraid.tests.test_recovery
-from gocept.zeoraid.tests.dumbstorage import DumbStorage
+from gocept.zeoraid.tests.loggingstorage import LoggingStorage
from ZEO.ClientStorage import ClientStorage
from ZEO.tests import forker, CommitLockTests, ThreadTests
@@ -1372,16 +1372,16 @@
pass
-class DumbStorageOpener(object):
+class LoggingStorageOpener(object):
def __init__(self, name, **kwargs):
self.name = name
def open(self, **kwargs):
- return DumbStorage(self.name)
+ return LoggingStorage(self.name)
-class DumbStorageTestSetup(StorageTestBase.StorageTestBase):
+class LoggingStorageTestSetup(StorageTestBase.StorageTestBase):
backend_count = 5
@@ -1392,7 +1392,7 @@
def setUp(self):
self._storages = []
for i in xrange(self.backend_count):
- self._storages.append(DumbStorageOpener(str(i)))
+ self._storages.append(LoggingStorageOpener(str(i)))
self._storage = gocept.zeoraid.storage.RAIDStorage(
'teststorage', self._storages)
@@ -1400,12 +1400,13 @@
self._storage.close()
-class DumbStorageDistributedTests(DumbStorageTestSetup):
+class LoggingStorageDistributedTests(LoggingStorageTestSetup):
+
def test_distributed_single_calls(self):
for i in xrange(50):
self._storage.getSize()
# assert that every storage gets called at least one time
- for x in xrange(5):
+ for x in xrange(self.backend_count):
self.assertEquals(len(self._backend(x)._log) >= 1, True)
@@ -1414,5 +1415,5 @@
suite.addTest(unittest.makeSuite(ZEOReplicationStorageTests, "check"))
suite.addTest(unittest.makeSuite(FailingStorageTests))
suite.addTest(unittest.makeSuite(FailingStorageSharedBlobTests))
- suite.addTest(unittest.makeSuite(DumbStorageDistributedTests))
+ suite.addTest(unittest.makeSuite(LoggingStorageDistributedTests))
return suite
More information about the Checkins
mailing list