Commit 1a4fbe99 authored by Hanno Schlichting's avatar Hanno Schlichting

More PEP8 cleanup

parent 4db38902
...@@ -11,5 +11,3 @@ ...@@ -11,5 +11,3 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
""" tempstorage package
"""
...@@ -10,5 +10,3 @@ ...@@ -10,5 +10,3 @@
</sectiontype> </sectiontype>
</component> </component>
...@@ -11,9 +11,12 @@ ...@@ -11,9 +11,12 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
from ZODB.config import BaseConfig from ZODB.config import BaseConfig
class TemporaryStorage(BaseConfig): class TemporaryStorage(BaseConfig):
def open(self): def open(self):
from tempstorage.TemporaryStorage import TemporaryStorage from tempstorage.TemporaryStorage import TemporaryStorage
return TemporaryStorage(self.config.name) return TemporaryStorage(self.config.name)
...@@ -11,4 +11,3 @@ ...@@ -11,4 +11,3 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
# make this a package.
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
import unittest import unittest
from ZODB.tests import StorageTestBase from ZODB.tests import StorageTestBase
...@@ -19,9 +20,8 @@ from ZODB.tests import Synchronization ...@@ -19,9 +20,8 @@ from ZODB.tests import Synchronization
from ZODB.tests import ConflictResolution from ZODB.tests import ConflictResolution
from ZODB.tests import MTStorage from ZODB.tests import MTStorage
class ZODBProtocolTests(StorageTestBase.StorageTestBase, class ZODBProtocolTests(StorageTestBase.StorageTestBase,
# not a revision storage, but passes
#RevisionStorage.RevisionStorage,
BasicStorage.BasicStorage, BasicStorage.BasicStorage,
Synchronization.SynchronizedStorage, Synchronization.SynchronizedStorage,
ConflictResolution.ConflictResolvingStorage, ConflictResolution.ConflictResolvingStorage,
...@@ -105,7 +105,7 @@ class TemporaryStorageTests(unittest.TestCase): ...@@ -105,7 +105,7 @@ class TemporaryStorageTests(unittest.TestCase):
tm2 = transaction.TransactionManager() tm2 = transaction.TransactionManager()
cn2 = db.open(transaction_manager=tm2) cn2 = db.open(transaction_manager=tm2)
r2 = cn2.root() r2 = cn2.root()
ignored = r2["p"] # force a read to unghostify the root. r2["p"]._p_activate()
self.assertEqual(r1._p_serial, r2._p_serial) self.assertEqual(r1._p_serial, r2._p_serial)
...@@ -120,7 +120,7 @@ class TemporaryStorageTests(unittest.TestCase): ...@@ -120,7 +120,7 @@ class TemporaryStorageTests(unittest.TestCase):
# in the transaction and obj was modified by the other # in the transaction and obj was modified by the other
# transaction. # transaction.
obj.child1 obj.child1
return obj return obj
def test_conflict_cache_clears_over_time(self): def test_conflict_cache_clears_over_time(self):
...@@ -131,22 +131,22 @@ class TemporaryStorageTests(unittest.TestCase): ...@@ -131,22 +131,22 @@ class TemporaryStorageTests(unittest.TestCase):
storage._conflict_cache_maxage = 1 # second storage._conflict_cache_maxage = 1 # second
oid = storage.new_oid() oid = storage.new_oid()
self._dostore(storage,oid, data=MinPO(5)) self._dostore(storage, oid, data=MinPO(5))
time.sleep(2) time.sleep(2)
oid2 = storage.new_oid() oid2 = storage.new_oid()
self._dostore(storage,oid2, data=MinPO(10)) self._dostore(storage, oid2, data=MinPO(10))
oid3 = storage.new_oid() oid3 = storage.new_oid()
self._dostore(storage,oid3, data=MinPO(9)) self._dostore(storage, oid3, data=MinPO(9))
self.assertEqual(len(storage._conflict_cache), 2) self.assertEqual(len(storage._conflict_cache), 2)
time.sleep(2) time.sleep(2)
oid4 = storage.new_oid() oid4 = storage.new_oid()
self._dostore(storage,oid4, data=MinPO(11)) self._dostore(storage, oid4, data=MinPO(11))
self.assertEqual(len(storage._conflict_cache), 1) self.assertEqual(len(storage._conflict_cache), 1)
...@@ -164,13 +164,13 @@ class TemporaryStorageTests(unittest.TestCase): ...@@ -164,13 +164,13 @@ class TemporaryStorageTests(unittest.TestCase):
from ZODB.tests.MinPO import MinPO from ZODB.tests.MinPO import MinPO
storage = self._makeOne() storage = self._makeOne()
oid = storage.new_oid() oid = storage.new_oid()
self._dostore(storage,oid, data=MinPO(1)) self._dostore(storage, oid, data=MinPO(1))
loadp, loads = storage.load(oid, 'whatever') loadp, loads = storage.load(oid, 'whatever')
exp, exs, exv = storage.loadEx(oid, 'whatever') exp, exs, exv = storage.loadEx(oid, 'whatever')
self.assertEqual(loadp, exp) self.assertEqual(loadp, exp)
self.assertEqual(loads, exs) self.assertEqual(loads, exs)
self.assertEqual(exv, '') self.assertEqual(exv, '')
def test_suite(): def test_suite():
return unittest.TestSuite(( return unittest.TestSuite((
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment