Commit b7ba4560 authored by Mauro Amico's avatar Mauro Amico

fix ZopeUndo.Prefix decode on python 2

parent d8438a30
......@@ -33,6 +33,7 @@ tests_require = [
'random2',
'mock',
'msgpack-python',
'ZopeUndo',
]
classifiers = """
......
......@@ -157,7 +157,7 @@ def find_global(module, name):
def server_find_global(module, name):
"""Helper for message unpickler"""
try:
if module != 'ZopeUndo.Prefix':
if module not in ('ZopeUndo.Prefix', 'copy_reg', '__builtin__'):
raise ImportError
m = __import__(module, _globals, _globals, _silly)
except ImportError as msg:
......
import unittest
from ZEO.asyncio.marshal import encode
from ZEO.asyncio.marshal import pickle_server_decode
from ZopeUndo.Prefix import Prefix
class MarshalTests(unittest.TestCase):
def testServerDecodeZopeUndoFilter(self):
# this is an example of Zope's
args = (0, 20, {'user_name': Prefix('test')})
# test against repr because Prefix __eq__ operator
# doesn't compare Prefix with Prefix but only
# Prefix with strings. see Prefix.__doc__
self.assertEqual(
repr(pickle_server_decode(encode(*args))),
repr(args)
)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(MarshalTests))
return suite
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