Commit c922735b authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent d9e13fbe
...@@ -23,6 +23,7 @@ from wendelin.lib import testing ...@@ -23,6 +23,7 @@ from wendelin.lib import testing
from persistent import Persistent, UPTODATE, GHOST, CHANGED from persistent import Persistent, UPTODATE, GHOST, CHANGED
from ZODB import DB, POSException from ZODB import DB, POSException
from ZODB.FileStorage import FileStorage from ZODB.FileStorage import FileStorage
from ZODB.MappingStorage import MappingStorage
from BTrees.IOBTree import IOBTree from BTrees.IOBTree import IOBTree
import transaction import transaction
from transaction import TransactionManager from transaction import TransactionManager
...@@ -291,7 +292,7 @@ def test_zconn_at(): ...@@ -291,7 +292,7 @@ def test_zconn_at():
assert zconn_at(conn2) == at0 assert zconn_at(conn2) == at0
# reopen conn2 -> view upated to @at1_ # reopen conn2 -> view updated to @at1_
conn2.close() conn2.close()
conn2_ = db.open(transaction_manager=tm1) conn2_ = db.open(transaction_manager=tm1)
assert conn2_ is conn2 # from DB pool assert conn2_ is conn2 # from DB pool
...@@ -373,13 +374,17 @@ def test_zurlstable(): ...@@ -373,13 +374,17 @@ def test_zurlstable():
# ---- tests for critical properties of ZODB ---- # ---- tests for critical properties of ZODB ----
# verify race in between Connection.open and invalidations. # verify race in between Connection.open and invalidations.
def test_zodb_zopenrace_basic():
# exercises mostly logic inside ZODB around ZODB.Connection
zopenrace.test(MappingStorage())
def test_zodb_zopenrace(): def test_zodb_zopenrace():
# exercises ZODB.Connection + particular storage implementation
zopenrace.main() zopenrace.main()
# verify race in between loading and invalidations. # verify race in between loading and invalidations.
def test_zodb_zloadrace(): def test_zodb_zloadrace():
# skip testing with FileStorage - in ZODB/py opening simultaneous read-write # skip testing with FileStorage - in ZODB/py opening simultaneous read-write
# connections to the same file is not supported and will raise Lockerror. # connections to the same file is not supported and will raise LockError.
_ = testdb.getZODBStorage() _ = testdb.getZODBStorage()
_.close() _.close()
if isinstance(_, FileStorage): if isinstance(_, FileStorage):
......
...@@ -111,8 +111,13 @@ def main(): ...@@ -111,8 +111,13 @@ def main():
defer(tdb.teardown) defer(tdb.teardown)
zstor = tdb.getZODBStorage() zstor = tdb.getZODBStorage()
db = DB(zstor) defer(zstor.close)
test(zstor)
@func
def test(zstor):
db = DB(zstor)
defer(db.close)
# init initializes the database with two integer objects - obj1/obj2 that are set to 0. # init initializes the database with two integer objects - obj1/obj2 that are set to 0.
def init(): def init():
......
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