Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
0d2a65b6
Commit
0d2a65b6
authored
May 22, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrap the nested statements.
parent
3acc4b7e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
14 deletions
+28
-14
src/ZEO/tests/protocols.test
src/ZEO/tests/protocols.test
+16
-8
src/ZEO/tests/zeo_blob_cache.test
src/ZEO/tests/zeo_blob_cache.test
+12
-6
No files found.
src/ZEO/tests/protocols.test
View file @
0d2a65b6
...
@@ -34,7 +34,8 @@ A current client should be able to connect to a old server:
...
@@ -34,7 +34,8 @@ A current client should be able to connect to a old server:
2
2
>>> conn.root()['
blob1
'] = ZODB.blob.Blob()
>>> conn.root()['
blob1
'] = ZODB.blob.Blob()
>>> with conn.root()['
blob1
'].open('
w
') as f: r = f.write(b'
blob
data
1
')
>>> with conn.root()['
blob1
'].open('
w
') as f:
... r = f.write(b'
blob
data
1
')
>>> transaction.commit()
>>> transaction.commit()
>>> db2 = ZEO.DB(addr, blob_dir='
server
-
blobs
', shared_blob_dir=True)
>>> db2 = ZEO.DB(addr, blob_dir='
server
-
blobs
', shared_blob_dir=True)
...
@@ -44,7 +45,8 @@ A current client should be able to connect to a old server:
...
@@ -44,7 +45,8 @@ A current client should be able to connect to a old server:
... conn2.root().x += 1
... conn2.root().x += 1
... transaction.commit()
... transaction.commit()
>>> conn2.root()['
blob2
'] = ZODB.blob.Blob()
>>> conn2.root()['
blob2
'] = ZODB.blob.Blob()
>>> with conn2.root()['
blob2
'].open('
w
') as f: r = f.write(b'
blob
data
2
')
>>> with conn2.root()['
blob2
'].open('
w
') as f:
... r = f.write(b'
blob
data
2
')
>>> transaction.commit()
>>> transaction.commit()
>>> @wait_until("Get the new data")
>>> @wait_until("Get the new data")
...
@@ -76,9 +78,11 @@ A current client should be able to connect to a old server:
...
@@ -76,9 +78,11 @@ A current client should be able to connect to a old server:
>>> conn.root().x
>>> conn.root().x
17
17
>>> with conn.root()['
blob1
'].open() as f: f.read()
>>> with conn.root()['
blob1
'].open() as f:
... f.read()
b'
blob
data
1
'
b'
blob
data
1
'
>>> with conn.root()['
blob2
'].open() as f: f.read()
>>> with conn.root()['
blob2
'].open() as f:
... f.read()
b'
blob
data
2
'
b'
blob
data
2
'
Note that when taking to a 3.8 server, iteration won'
t
work
:
Note that when taking to a 3.8 server, iteration won'
t
work
:
...
@@ -118,7 +122,8 @@ Note that we'll have to pull some hijinks:
...
@@ -118,7 +122,8 @@ Note that we'll have to pull some hijinks:
2
2
>>> conn.root()['
blob1
'] = ZODB.blob.Blob()
>>> conn.root()['
blob1
'] = ZODB.blob.Blob()
>>> with conn.root()['
blob1
'].open('
w
') as f: r = f.write(b'
blob
data
1
')
>>> with conn.root()['
blob1
'].open('
w
') as f:
... r = f.write(b'
blob
data
1
')
>>> transaction.commit()
>>> transaction.commit()
>>> db2 = ZEO.DB(addr, blob_dir='
server
-
blobs
', shared_blob_dir=True)
>>> db2 = ZEO.DB(addr, blob_dir='
server
-
blobs
', shared_blob_dir=True)
...
@@ -128,7 +133,8 @@ Note that we'll have to pull some hijinks:
...
@@ -128,7 +133,8 @@ Note that we'll have to pull some hijinks:
... conn2.root().x += 1
... conn2.root().x += 1
... transaction.commit()
... transaction.commit()
>>> conn2.root()['
blob2
'] = ZODB.blob.Blob()
>>> conn2.root()['
blob2
'] = ZODB.blob.Blob()
>>> with conn2.root()['
blob2
'].open('
w
') as f: r = f.write(b'
blob
data
2
')
>>> with conn2.root()['
blob2
'].open('
w
') as f:
... r = f.write(b'
blob
data
2
')
>>> transaction.commit()
>>> transaction.commit()
...
@@ -161,9 +167,11 @@ Note that we'll have to pull some hijinks:
...
@@ -161,9 +167,11 @@ Note that we'll have to pull some hijinks:
>>> conn.root().x
>>> conn.root().x
17
17
>>> with conn.root()['
blob1
'].open() as f: f.read()
>>> with conn.root()['
blob1
'].open() as f:
... f.read()
b'
blob
data
1
'
b'
blob
data
1
'
>>> with conn.root()['
blob2
'].open() as f: f.read()
>>> with conn.root()['
blob2
'].open() as
... f: f.read()
b'
blob
data
2
'
b'
blob
data
2
'
Make some old protocol calls:
Make some old protocol calls:
...
...
src/ZEO/tests/zeo_blob_cache.test
View file @
0d2a65b6
...
@@ -52,7 +52,8 @@ Now, let's write some data:
...
@@ -52,7 +52,8 @@ Now, let's write some data:
>>>
conn
=
db
.
open
()
>>>
conn
=
db
.
open
()
>>>
for
i
in
range
(
1
,
101
)
:
>>>
for
i
in
range
(
1
,
101
)
:
...
conn
.
root
()[
i
]
=
ZODB
.
blob
.
Blob
()
...
conn
.
root
()[
i
]
=
ZODB
.
blob
.
Blob
()
...
with
conn
.
root
()[
i
]
.
open
(
'w'
)
as
f
:
w
=
f
.
write
((
chr
(
i
)
*
100
)
.
encode
(
'ascii'
))
...
with
conn
.
root
()[
i
]
.
open
(
'w'
)
as
f
:
...
w
=
f
.
write
((
chr
(
i
)
*
100
)
.
encode
(
'ascii'
))
>>>
transaction
.
commit
()
>>>
transaction
.
commit
()
We
've committed 10000 bytes of data, but our target size is 3000. We
We
've committed 10000 bytes of data, but our target size is 3000. We
...
@@ -85,19 +86,22 @@ necessary, but the cache size will remain not much bigger than the
...
@@ -85,19 +86,22 @@ necessary, but the cache size will remain not much bigger than the
target:
target:
>>> for i in range(1, 101):
>>> for i in range(1, 101):
... with conn.root()[i].open() as f: data = f.read()
... with conn.root()[i].open() as f:
... data = f.read()
... if data != (chr(i)*100).encode('
ascii
'):
... if data != (chr(i)*100).encode('
ascii
'):
... print('
bad
data
', repr(chr(i)), repr(data))
... print('
bad
data
', repr(chr(i)), repr(data))
>>> wait_until("size is reduced", check, 99, onfail)
>>> wait_until("size is reduced", check, 99, onfail)
>>> for i in range(1, 101):
>>> for i in range(1, 101):
... with conn.root()[i].open() as f: data = f.read()
... with conn.root()[i].open() as f:
... data = f.read()
... if data != (chr(i)*100).encode('
ascii
'):
... if data != (chr(i)*100).encode('
ascii
'):
... print('
bad
data
', repr(chr(i)), repr(data))
... print('
bad
data
', repr(chr(i)), repr(data))
>>> for i in range(1, 101):
>>> for i in range(1, 101):
... with conn.root()[i].open('
c
') as f: data = f.read()
... with conn.root()[i].open('
c
') as f:
... data = f.read()
... if data != (chr(i)*100).encode('
ascii
'):
... if data != (chr(i)*100).encode('
ascii
'):
... print('
bad
data
', repr(chr(i)), repr(data))
... print('
bad
data
', repr(chr(i)), repr(data))
...
@@ -114,11 +118,13 @@ provoke problems:
...
@@ -114,11 +118,13 @@ provoke problems:
...
for
i
in
range
(
300
)
:
...
for
i
in
range
(
300
)
:
...
time
.
sleep
(
0
)
...
time
.
sleep
(
0
)
...
i
=
random
.
randint
(
1
,
100
)
...
i
=
random
.
randint
(
1
,
100
)
...
with
conn
.
root
()[
i
]
.
open
()
as
f
:
data
=
f
.
read
()
...
with
conn
.
root
()[
i
]
.
open
()
as
f
:
...
data
=
f
.
read
()
...
if
data
!=
(
chr
(
i
)
*
100
)
.
encode
(
'ascii'
)
:
...
if
data
!=
(
chr
(
i
)
*
100
)
.
encode
(
'ascii'
)
:
...
print
(
'bad data'
,
repr
(
chr
(
i
)),
repr
(
data
))
...
print
(
'bad data'
,
repr
(
chr
(
i
)),
repr
(
data
))
...
i
=
random
.
randint
(
1
,
100
)
...
i
=
random
.
randint
(
1
,
100
)
...
with
conn
.
root
()[
i
]
.
open
(
'c'
)
as
f
:
data
=
f
.
read
()
...
with
conn
.
root
()[
i
]
.
open
(
'c'
)
as
f
:
...
data
=
f
.
read
()
...
if
data
!=
(
chr
(
i
)
*
100
)
.
encode
(
'ascii'
)
:
...
if
data
!=
(
chr
(
i
)
*
100
)
.
encode
(
'ascii'
)
:
...
print
(
'bad data'
,
repr
(
chr
(
i
)),
repr
(
data
))
...
print
(
'bad data'
,
repr
(
chr
(
i
)),
repr
(
data
))
...
db
.
close
()
...
db
.
close
()
...
...
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