Commit 4b0ea80d authored by Marius Gedminas's avatar Marius Gedminas

Bite the bullet and deal with Python 3 fat pickles

parent 66cb84d3
......@@ -29,7 +29,11 @@ checker = renormalizing.RENormalizing([
(re.compile("ZODB.POSException.POSKeyError"), r"POSKeyError"),
(re.compile("ZODB.FileStorage.FileStorage.FileStorageQuotaError"),
r"FileStorageQuotaError"),
])
# Python 3 produces larger pickles, even when we use zodbpickle :(
# this changes all the offsets in iterator.test
(re.compile('data.fs:207766'), 'data.fs:117080'),
(re.compile('data.fs:57991'), 'data.fs:35936'),
])
def pack_keep_old():
"""Should a copy of the database be kept?
......
......@@ -26,6 +26,12 @@ checker = zope.testing.renormalizing.RENormalizing([
# Python 3 bytes add a "b".
(re.compile("b('.*?')"), r"\1"),
(re.compile('b(".*?")'), r"\1"),
# Python 3 produces larger pickles, even when we use zodbpickle :(
# this changes all the offsets and sizes in fstail.txt
(re.compile("user='' description='' length=138 offset=190"),
"user='' description='' length=132 offset=185"),
(re.compile("user='' description='initial database creation' length=155 offset=52"),
"user='' description='initial database creation' length=150 offset=52"),
])
def test_suite():
......
......@@ -67,12 +67,26 @@ Clean up.
>>> st.close()
"""
import re
import doctest
import zope.testing.setupstack
import ZODB.tests.util
from zope.testing import renormalizing
checker = renormalizing.RENormalizing([
# Normalizing this makes diffs easier to read
(re.compile(r'\btid=[0-9a-f]+\b'), 'tid=...'),
(re.compile(r'\b\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\.\d+\b'), '...'),
# Python 3 produces larger pickles, even when we use zodbpickle :(
# this changes all the offsets and sizes
(re.compile(r'\bsize=65\b'), 'size=60'),
(re.compile(r'\offset=206\b'), 'offset=201'),
(re.compile(r'\bsize=156\b'), 'size=107'),
])
def test_suite():
return doctest.DocTestSuite(
setUp=zope.testing.setupstack.setUpDirectory,
tearDown=zope.testing.setupstack.tearDown,
checker=ZODB.tests.util.checker)
checker=ZODB.tests.util.checker + checker)
......@@ -167,8 +167,24 @@ Clean up.
>>> st.cleanup() # remove .fs, .index, etc
"""
import re
import doctest
import ZODB.tests.util
from zope.testing import renormalizing
checker = renormalizing.RENormalizing([
# Normalizing this makes diffs easier to read
(re.compile(r'\btid 0x[0-9a-f]+\b'), 'tid 0x...'),
(re.compile(r'\b\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\.\d+\b'), '...'),
# Python 3 produces larger pickles, even when we use zodbpickle :(
# this changes all the offsets and sizes
(re.compile(r'\boffset=167\b'), 'offset=162'),
(re.compile(r'\boffset=483\b'), 'offset=429'),
(re.compile(r'(PersistentMapping|OOBTree) at 206\b'), r'\1 at 201'),
(re.compile(r'(OOBTree) at 404\b'), r'\1 at 350'),
(re.compile(r'(PersistentMapping|OOBTree) at 531\b'), r'\1 at 477'),
])
def test_suite():
return doctest.DocTestSuite(checker=ZODB.tests.util.checker)
return doctest.DocTestSuite(checker=ZODB.tests.util.checker + checker)
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