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
320e4d78
Commit
320e4d78
authored
Mar 13, 2013
by
Albertas Agejevas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More Py3 porting.
parent
366414ae
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
23 deletions
+30
-23
src/ZEO/scripts/zeopack.py
src/ZEO/scripts/zeopack.py
+1
-1
src/ZEO/scripts/zeopack.test
src/ZEO/scripts/zeopack.test
+9
-9
src/ZEO/tests/dynamic_server_ports.test
src/ZEO/tests/dynamic_server_ports.test
+1
-1
src/ZEO/tests/testZEO.py
src/ZEO/tests/testZEO.py
+10
-3
src/ZEO/tests/testZEO2.py
src/ZEO/tests/testZEO2.py
+3
-3
src/ZEO/tests/zeo_blob_cache.test
src/ZEO/tests/zeo_blob_cache.test
+6
-6
No files found.
src/ZEO/scripts/zeopack.py
View file @
320e4d78
...
...
@@ -85,7 +85,7 @@ def _main(args=None, prog=None):
packt
=
time
.
time
()
if
options
.
time
:
time_
=
map
(
int
,
options
.
time
.
split
(
':'
))
time_
=
list
(
map
(
int
,
options
.
time
.
split
(
':'
)
))
if
len
(
time_
)
==
1
:
time_
+=
(
0
,
0
)
elif
len
(
time_
)
==
2
:
...
...
src/ZEO/scripts/zeopack.test
View file @
320e4d78
...
...
@@ -14,25 +14,25 @@ for our test:
... logging.getLogger('
test
.
ClientStorage
').error(
... "I hate this address, %r", args[0])
... raise ValueError("Bad address")
... print
"ClientStorage(%s %s)" % (
... print
(
"ClientStorage(%s %s)" % (
... repr(args)[1:-1],
... '
,
'.join("%s=%r" % i for i in sorted(kw.items())),
... )
... )
)
... def pack(self, t=None, *args, **kw):
... now = time.localtime(time.time())
... local_midnight = time.mktime(now[:3]+(0, 0, 0)+now[6:])
... t -= local_midnight # adjust for tz
... t += 86400*7 # add a week to make sure we'
re
positive
...
print
"pack(%r,%s %s)"
%
(
...
print
(
"pack(%r,%s %s)"
%
(
...
t
,
repr
(
args
)[
1
:-
1
],
...
', '
.
join
(
"%s=%r"
%
i
for
i
in
sorted
(
kw
.
items
())),
...
)
...
)
)
...
def
is_connected
(
self
)
:
...
self
.
connect_wait
-=
1
...
print
'is_connected'
,
self
.
connect_wait
<
0
...
print
(
'is_connected'
,
self
.
connect_wait
<
0
)
...
return
self
.
connect_wait
<
0
...
def
close
(
self
)
:
...
print
"close()"
...
print
(
"close()"
)
>>>
import
ZEO
>>>
ClientStorage_orig
=
ZEO
.
ClientStorage
.
ClientStorage
...
...
@@ -83,7 +83,7 @@ value is timezone dependent.
>>>
time
.
time
=
lambda
:
time
.
mktime
((
2009
,
3
,
24
,
10
,
55
,
17
,
1
,
83
,
-
1
))
>>>
sleep_orig
=
time
.
sleep
>>>
def
sleep
(
t
)
:
...
print
'sleep(%r)'
%
t
...
print
(
'sleep(%r)'
%
t
)
>>>
time
.
sleep
=
sleep
Normally
,
we
pass
one
or
more
TCP
server
specifications
:
...
...
@@ -178,8 +178,8 @@ seconds of waiting for a connect.
...
try
:
...
try
:
...
main
(
args
)
...
except
SystemExit
,
v
:
...
print
"Exited"
,
v
...
except
SystemExit
as
v
:
...
print
(
"Exited"
,
v
)
...
finally
:
...
sys
.
stderr
=
old_stderr
...
...
src/ZEO/tests/dynamic_server_ports.test
View file @
320e4d78
...
...
@@ -82,7 +82,7 @@ dynamic port using ZConfig, you'd use a hostname by itself. In this
case, ZConfig passes None as the port.
>>> import ZEO.runzeo
>>> open('
conf
', '
w
').write("""
>>>
r =
open('
conf
', '
w
').write("""
... <zeo>
... address 127.0.0.1
... </zeo>
...
...
src/ZEO/tests/testZEO.py
View file @
320e4d78
...
...
@@ -13,6 +13,7 @@
##############################################################################
"""Test suite for ZEO based on ZODB.tests."""
from
__future__
import
print_function
import
re
from
ZEO.ClientStorage
import
ClientStorage
from
ZEO.tests.forker
import
get_port
...
...
@@ -1453,7 +1454,7 @@ def generate_script(name, src):
def
runzeo_logrotate_on_sigusr2
():
"""
>>> port = get_port()
>>> open('c', 'w').write('''
>>>
r =
open('c', 'w').write('''
... <zeo>
... address %s
... </zeo>
...
...
@@ -1756,8 +1757,14 @@ def test_suite():
(
re
.
compile
(
r"'start': '[^\n]+'"
),
'start'
),
]),
))
zeo
.
addTest
(
doctest
.
DocTestSuite
(
ZEO
.
tests
.
IterationTests
,
setUp
=
forker
.
setUp
,
tearDown
=
zope
.
testing
.
setupstack
.
tearDown
))
zeo
.
addTest
(
doctest
.
DocTestSuite
(
ZEO
.
tests
.
IterationTests
,
setUp
=
forker
.
setUp
,
tearDown
=
zope
.
testing
.
setupstack
.
tearDown
,
checker
=
renormalizing
.
RENormalizing
((
(
re
.
compile
(
"ZEO.Exceptions.ClientDisconnected"
),
"ClientDisconnected"
),
)),
))
zeo
.
addTest
(
doctest
.
DocFileSuite
(
'registerDB.test'
))
zeo
.
addTest
(
doctest
.
DocFileSuite
(
...
...
src/ZEO/tests/testZEO2.py
View file @
320e4d78
...
...
@@ -231,7 +231,7 @@ We start a transaction and vote, this leads to getting the lock.
ZEO.StorageServer DEBUG
(test-addr-1) ('1') lock: transactions waiting: 0
ZEO.StorageServer BLATHER
(test-addr-1) Preparing to commit transaction: 1 objects,
36
bytes
(test-addr-1) Preparing to commit transaction: 1 objects,
...
bytes
1 callAsync serialnos ...
If another client tried to vote, it's lock request will be queued and
...
...
@@ -253,7 +253,7 @@ When we end the first transaction, the queued vote gets the lock.
ZEO.StorageServer DEBUG
(test-addr-2) ('1') lock: transactions waiting: 0
ZEO.StorageServer BLATHER
(test-addr-2) Preparing to commit transaction: 1 objects,
36
bytes
(test-addr-2) Preparing to commit transaction: 1 objects,
...
bytes
2 callAsync serialnos ...
Let's try again with the first client. The vote will be queued:
...
...
@@ -328,7 +328,7 @@ release the lock and one of the waiting clients will get the lock.
ZEO.StorageServer WARNING
(test-addr-1) ('1') lock: transactions waiting: 9
ZEO.StorageServer BLATHER
(test-addr-1) Preparing to commit transaction: 1 objects,
36
bytes
(test-addr-1) Preparing to commit transaction: 1 objects,
...
bytes
1 callAsync serialnos ...
(In practice, waiting clients won't necessarily get the lock in order.)
...
...
src/ZEO/tests/zeo_blob_cache.test
View file @
320e4d78
...
...
@@ -52,7 +52,7 @@ Now, let's write some data:
>>>
conn
=
db
.
open
()
>>>
for
i
in
range
(
1
,
101
)
:
...
conn
.
root
()[
i
]
=
ZODB
.
blob
.
Blob
()
...
conn
.
root
()[
i
]
.
open
(
'w'
)
.
write
(
chr
(
i
)
*
100
)
...
w
=
conn
.
root
()[
i
]
.
open
(
'w'
)
.
write
((
chr
(
i
)
*
100
)
.
encode
(
'ascii'
)
)
>>>
transaction
.
commit
()
We
've committed 10000 bytes of data, but our target size is 3000. We
...
...
@@ -86,19 +86,19 @@ target:
>>> for i in range(1, 101):
... data = conn.root()[i].open().read()
... if data !=
chr(i)*100
:
... if data !=
(chr(i)*100).encode('
ascii
')
:
... print('
bad
data
', repr(chr(i)), repr(data))
>>> wait_until("size is reduced", check, 99, onfail)
>>> for i in range(1, 101):
... data = conn.root()[i].open().read()
... if data !=
chr(i)*100
:
... if data !=
(chr(i)*100).encode('
ascii
')
:
... print('
bad
data
', repr(chr(i)), repr(data))
>>> for i in range(1, 101):
... data = conn.root()[i].open('
c
').read()
... if data !=
chr(i)*100
:
... if data !=
(chr(i)*100).encode('
ascii
')
:
... print('
bad
data
', repr(chr(i)), repr(data))
>>> wait_until("size is reduced", check, 99, onfail)
...
...
@@ -115,11 +115,11 @@ provoke problems:
...
time
.
sleep
(
0
)
...
i
=
random
.
randint
(
1
,
100
)
...
data
=
conn
.
root
()[
i
]
.
open
()
.
read
()
...
if
data
!=
chr
(
i
)
*
100
:
...
if
data
!=
(
chr
(
i
)
*
100
)
.
encode
(
'ascii'
)
:
...
print
(
'bad data'
,
repr
(
chr
(
i
)),
repr
(
data
))
...
i
=
random
.
randint
(
1
,
100
)
...
data
=
conn
.
root
()[
i
]
.
open
(
'c'
)
.
read
()
...
if
data
!=
chr
(
i
)
*
100
:
...
if
data
!=
(
chr
(
i
)
*
100
)
.
encode
(
'ascii'
)
:
...
print
(
'bad data'
,
repr
(
chr
(
i
)),
repr
(
data
))
...
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