Commit 302e5645 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 2bd98841
#!/usr/bin/env python2 #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# TODO author/copyright # TODO author/copyright
# TODO move gen .fs & .index part to zodbtools and use it there for tests
"""generate reference database and index for tests""" """generate reference database and index for tests"""
from ZODB.FileStorage import FileStorage from ZODB.FileStorage import FileStorage
...@@ -72,7 +73,8 @@ def main(): ...@@ -72,7 +73,8 @@ def main():
random.seed(0) random.seed(0)
namev = [_ for _ in "abcdefg"] namev = [_ for _ in "abcdefg"]
for i in range(2): Niter = 2
for i in range(Niter):
stor = FileStorage(outfs, create=(i == 0)) stor = FileStorage(outfs, create=(i == 0))
db = DB(stor) db = DB(stor)
conn = db.open() conn = db.open()
...@@ -111,6 +113,10 @@ def main(): ...@@ -111,6 +113,10 @@ def main():
stor.tpc_begin(txn) stor.tpc_begin(txn)
stor.deleteObject(obj._p_oid, obj._p_serial, txn) stor.deleteObject(obj._p_oid, obj._p_serial, txn)
stor.tpc_vote(txn) stor.tpc_vote(txn)
# TODO different txn status vvv
# XXX vvv it does the thing, but py fs iterator treats this txn as EOF
#if i != Niter-1:
# stor.tpc_finish(txn)
stor.tpc_finish(txn) stor.tpc_finish(txn)
# close db & rest not to get conflict errors after we touched stor # close db & rest not to get conflict errors after we touched stor
...@@ -120,8 +126,6 @@ def main(): ...@@ -120,8 +126,6 @@ def main():
stor.close() stor.close()
# TODO different txn status
# dump to go what to expect # dump to go what to expect
with open("testdata_expect_test.go", "w") as f: with open("testdata_expect_test.go", "w") as f:
def emit(v): def emit(v):
......
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