Commit 62b21d01 authored by Kirill Smelkov's avatar Kirill Smelkov

*: cStringIO.StringIO -> io.BytesIO

There is no cStringIO on Python3:

	test_dump.py:26: in <module>
	    from cStringIO import StringIO
	E   ModuleNotFoundError: No module named 'cStringIO'

Based on patch by Jérome Perrin.
parent 00a534ef
# Copyright (C) 2017-2018 Nexedi SA and Contributors. # -*- coding: utf-8 -*-
# Copyright (C) 2017-2019 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com> # Kirill Smelkov <kirr@nexedi.com>
# Jérome Perrin <jerome@nexedi.com>
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your # it under the terms of the GNU General Public License version 3, or (at your
...@@ -23,7 +25,7 @@ from zodbtools.zodbdump import ( ...@@ -23,7 +25,7 @@ from zodbtools.zodbdump import (
) )
from ZODB.FileStorage import FileStorage from ZODB.FileStorage import FileStorage
from ZODB.utils import p64 from ZODB.utils import p64
from cStringIO import StringIO from io import BytesIO
from os.path import dirname from os.path import dirname
...@@ -39,7 +41,7 @@ def test_zodbdump(zext): ...@@ -39,7 +41,7 @@ def test_zodbdump(zext):
with open('%s/testdata/1%s.zdump.ok' % (tdir, zkind)) as f: with open('%s/testdata/1%s.zdump.ok' % (tdir, zkind)) as f:
dumpok = f.read() dumpok = f.read()
out = StringIO() out = BytesIO()
zodbdump(stor, None, None, out=out) zodbdump(stor, None, None, out=out)
assert out.getvalue() == dumpok assert out.getvalue() == dumpok
...@@ -69,7 +71,7 @@ extension "qqq" ...@@ -69,7 +71,7 @@ extension "qqq"
""" """
r = DumpReader(StringIO(in_)) r = DumpReader(BytesIO(in_))
t1 = r.readtxn() t1 = r.readtxn()
assert isinstance(t1, Transaction) assert isinstance(t1, Transaction)
assert t1.tid == '0123456789abcdef'.decode('hex') assert t1.tid == '0123456789abcdef'.decode('hex')
...@@ -117,7 +119,7 @@ extension "qqq" ...@@ -117,7 +119,7 @@ extension "qqq"
assert z == in_ assert z == in_
# unknown hash function # unknown hash function
r = DumpReader(StringIO("""\ r = DumpReader(BytesIO("""\
txn 0000000000000000 " " txn 0000000000000000 " "
user "" user ""
description "" description ""
...@@ -130,7 +132,7 @@ obj 0000000000000001 1 xyz:0123 - ...@@ -130,7 +132,7 @@ obj 0000000000000001 1 xyz:0123 -
assert exc.value.args == ("""+5: invalid line: unknown hash function "xyz" ('obj 0000000000000001 1 xyz:0123 -')""",) assert exc.value.args == ("""+5: invalid line: unknown hash function "xyz" ('obj 0000000000000001 1 xyz:0123 -')""",)
# data integrity error # data integrity error
r = DumpReader(StringIO("""\ r = DumpReader(BytesIO("""\
txn 0000000000000000 " " txn 0000000000000000 " "
user "" user ""
description "" description ""
......
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