Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
c21c3730
Commit
c21c3730
authored
Feb 16, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4f7db880
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
11 deletions
+40
-11
t/neo/storage/fs1/gen-testdata
t/neo/storage/fs1/gen-testdata
+38
-11
t/neo/storage/fs1/testdata/.gitignore
t/neo/storage/fs1/testdata/.gitignore
+2
-0
t/neo/storage/fs1/testdata/1.fs
t/neo/storage/fs1/testdata/1.fs
+0
-0
t/neo/storage/fs1/testdata/1.fs.index
t/neo/storage/fs1/testdata/1.fs.index
+0
-0
No files found.
t/neo/storage/fs1/gen-testdata
View file @
c21c3730
#!/usr/bin/env python2
"""generate reference index and database for tests"""
import
ZODB
import
persistent
from
ZODB.FileStorage
import
FileStorage
from
ZODB
import
DB
from
persistent
import
Persistent
import
transaction
import
struct
import
random
import
logging
# convert numeric oid to str
def
oid
(
v
):
return
struct
.
pack
(
'>Q'
,
v
)
def
commit
(
user
,
description
,
extension
):
txn
=
transaction
.
get
()
txn
.
user
=
user
...
...
@@ -12,22 +21,40 @@ def commit(user, description, extension):
txn
.
extension
=
extension
txn
.
commit
()
class
Object
(
Persistent
):
# .value
def
__init__
(
self
,
value
):
self
.
value
=
value
def
__getstate__
(
self
):
return
self
.
value
def
__setstate__
(
self
,
state
):
self
.
value
=
state
def
main
():
logging
.
basicConfig
()
stor
=
FileStorage
(
"testdata/1.fs"
,
create
=
True
)
db
=
DB
(
stor
)
conn
=
db
.
open
()
root
=
conn
.
root
()
commit
(
u"root"
,
u"initial database creation"
,
{
"x-generator"
:
"zodb/py2"
})
assert
root
.
_p_oid
==
oid
(
0
),
`root._p_oid`
"""
root["..."] = obj
# generate random changes to objects hooked to top-level root by a/b/c/... key
random
.
seed
(
0
)
namev
=
[
_
for
_
in
"abcdefg"
]
for
i
in
range
(
50
):
name
=
random
.
choice
(
namev
)
if
name
in
root
:
obj
=
root
[
name
]
else
:
root
[
name
]
=
obj
=
Object
(
None
)
txn = transaction.get()
txn.user = u"user1" # XXX
txn.description = u"description1" # XXX
txn.extension = {"key1": value1, "key2": value2) # XXX
txn.commit()
"""
obj
.
value
=
"%s%i"
%
(
name
,
i
)
commit
(
u"user%i"
%
i
,
u"step %i"
%
i
,
{
"x-generator"
:
"zodb/py2 (%s)"
%
name
})
conn
.
close
()
db
.
close
()
...
...
t/neo/storage/fs1/testdata/.gitignore
0 → 100644
View file @
c21c3730
/*.lock
/*.tmp
t/neo/storage/fs1/testdata/1.fs
0 → 100644
View file @
c21c3730
File added
t/neo/storage/fs1/testdata/1.fs.index
0 → 100644
View file @
c21c3730
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment