Commit 1f9ba57d authored by Albertas Agejevas's avatar Albertas Agejevas

Add compatibility with Py2 back.

parent ec9bafb3
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
from __future__ import print_function
import doctest, re, unittest import doctest, re, unittest
from zope.testing import renormalizing from zope.testing import renormalizing
...@@ -21,7 +22,8 @@ def test_suite(): ...@@ -21,7 +22,8 @@ def test_suite():
checker=renormalizing.RENormalizing([ checker=renormalizing.RENormalizing([
(re.compile('usage: Usage: '), 'Usage: '), # Py 2.4 (re.compile('usage: Usage: '), 'Usage: '), # Py 2.4
(re.compile('options:'), 'Options:'), # Py 2.4 (re.compile('options:'), 'Options:'), # Py 2.4
]) ]),
globs={'print_function': print_function},
), ),
)) ))
...@@ -20,6 +20,7 @@ from ZEO.tests.forker import get_port ...@@ -20,6 +20,7 @@ from ZEO.tests.forker import get_port
from ZEO.tests import forker, Cache, CommitLockTests, ThreadTests from ZEO.tests import forker, Cache, CommitLockTests, ThreadTests
from ZEO.tests import IterationTests from ZEO.tests import IterationTests
from ZEO.zrpc.error import DisconnectedError from ZEO.zrpc.error import DisconnectedError
from ZEO._compat import PY3
from ZODB.tests import StorageTestBase, BasicStorage, \ from ZODB.tests import StorageTestBase, BasicStorage, \
TransactionalUndoStorage, \ TransactionalUndoStorage, \
PackableStorage, Synchronization, ConflictResolution, RevisionStorage, \ PackableStorage, Synchronization, ConflictResolution, RevisionStorage, \
...@@ -1756,15 +1757,18 @@ def test_suite(): ...@@ -1756,15 +1757,18 @@ def test_suite():
# unit test layer # unit test layer
zeo = unittest.TestSuite() zeo = unittest.TestSuite()
zeo.addTest(unittest.makeSuite(ZODB.tests.util.AAAA_Test_Runner_Hack)) zeo.addTest(unittest.makeSuite(ZODB.tests.util.AAAA_Test_Runner_Hack))
patterns = [
(re.compile(r"'start': '[^\n]+'"), 'start'),
(re.compile("ZODB.POSException.ConflictError"), "ConflictError"),
(re.compile("ZODB.POSException.POSKeyError"), "POSKeyError"),
(re.compile("ZEO.Exceptions.ClientStorageError"), "ClientStorageError"),
]
if not PY3:
patterns.append((re.compile("^'(blob[^']*)'"), r"b'\1'"))
patterns.append((re.compile("^'Z308'"), "b'Z308'"))
zeo.addTest(doctest.DocTestSuite( zeo.addTest(doctest.DocTestSuite(
setUp=forker.setUp, tearDown=zope.testing.setupstack.tearDown, setUp=forker.setUp, tearDown=zope.testing.setupstack.tearDown,
checker=renormalizing.RENormalizing([ checker=renormalizing.RENormalizing(patterns),
(re.compile(r"'start': '[^\n]+'"), 'start'),
(re.compile("ZODB.POSException.ConflictError"), "ConflictError"),
(re.compile("ZODB.POSException.POSKeyError"), "POSKeyError"),
(re.compile("ZEO.Exceptions.ClientStorageError"),
"ClientStorageError"),
]),
)) ))
zeo.addTest(doctest.DocTestSuite( zeo.addTest(doctest.DocTestSuite(
ZEO.tests.IterationTests, ZEO.tests.IterationTests,
...@@ -1774,7 +1778,8 @@ def test_suite(): ...@@ -1774,7 +1778,8 @@ def test_suite():
"ClientDisconnected"), "ClientDisconnected"),
)), )),
)) ))
zeo.addTest(doctest.DocFileSuite('registerDB.test')) zeo.addTest(doctest.DocFileSuite(
'registerDB.test', globs={'print_function': print_function}))
zeo.addTest( zeo.addTest(
doctest.DocFileSuite( doctest.DocFileSuite(
'zeo-fan-out.test', 'zdoptions.test', 'zeo-fan-out.test', 'zdoptions.test',
...@@ -1782,6 +1787,8 @@ def test_suite(): ...@@ -1782,6 +1787,8 @@ def test_suite():
'protocols.test', 'zeo_blob_cache.test', 'invalidation-age.txt', 'protocols.test', 'zeo_blob_cache.test', 'invalidation-age.txt',
'dynamic_server_ports.test', 'new_addr.test', 'dynamic_server_ports.test', 'new_addr.test',
setUp=forker.setUp, tearDown=zope.testing.setupstack.tearDown, setUp=forker.setUp, tearDown=zope.testing.setupstack.tearDown,
checker=renormalizing.RENormalizing(patterns),
globs={'print_function': print_function},
), ),
) )
zeo.addTest(PackableStorage.IExternalGC_suite( zeo.addTest(PackableStorage.IExternalGC_suite(
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
from __future__ import print_function
from zope.testing import setupstack, renormalizing from zope.testing import setupstack, renormalizing
import doctest import doctest
import logging import logging
......
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