Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
ZODB
Commits
57e89244
Commit
57e89244
authored
Feb 20, 2013
by
Marius Gedminas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix fstest tests on Python 3
parent
37c20b52
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
14 deletions
+22
-14
src/ZODB/scripts/fstest.py
src/ZODB/scripts/fstest.py
+8
-11
src/ZODB/scripts/tests/test_fstest.py
src/ZODB/scripts/tests/test_fstest.py
+14
-3
No files found.
src/ZODB/scripts/fstest.py
View file @
57e89244
...
...
@@ -36,7 +36,7 @@ from __future__ import print_function
# ZODB.FileStorage. If anything about the FileStorage layout changes,
# this file will need to be udpated.
import
string
import
binascii
import
struct
import
sys
...
...
@@ -55,16 +55,13 @@ DREC_HDR_LEN = 42
VERBOSE
=
0
def
hexify
(
s
):
"""Format an 8-bit string as hex"""
l
=
[]
for
c
in
s
:
h
=
hex
(
ord
(
c
))
if
h
[:
2
]
==
'0x'
:
h
=
h
[
2
:]
if
len
(
h
)
==
1
:
l
.
append
(
"0"
)
l
.
append
(
h
)
return
"0x"
+
''
.
join
(
l
)
r"""Format an 8-bit string as hex
>>> hexify(b'\x00\xff\xaa\xcc')
'0x00ffaacc'
"""
return
'0x'
+
binascii
.
hexlify
(
s
).
decode
()
def
chatter
(
msg
,
level
=
1
):
if
VERBOSE
>=
level
:
...
...
src/ZODB/scripts/tests/test_fstest.py
View file @
57e89244
...
...
@@ -11,9 +11,13 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
from
zope.testing
import
setupstack
import
doctest
import
re
import
unittest
import
ZODB
from
zope.testing
import
setupstack
from
zope.testing.renormalizing
import
RENormalizing
def
test_fstest_verbose
():
r"""
...
...
@@ -39,6 +43,13 @@ def test_fstest_verbose():
def
test_suite
():
return
doctest
.
DocTestSuite
(
setUp
=
setupstack
.
setUpDirectory
,
tearDown
=
setupstack
.
tearDown
)
checker
=
RENormalizing
([
# Python 3 drops the u'' prefix on unicode strings
(
re
.
compile
(
r"u('[^']*')"
),
r"\1"
),
])
return
unittest
.
TestSuite
([
doctest
.
DocTestSuite
(
'ZODB.scripts.fstest'
,
checker
=
checker
),
doctest
.
DocTestSuite
(
setUp
=
setupstack
.
setUpDirectory
,
tearDown
=
setupstack
.
tearDown
),
])
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