Commit 80c33531 authored by Tres Seaver's avatar Tres Seaver

Add explicit support for PyPy.

parent d56d17df
......@@ -4,6 +4,8 @@ Changes
1.2.1 (unreleased)
------------------
- Added explicit support for PyPy.
- Dropped use of Python3-impatible ``zope.interface.implements`` class
advisor in favor of ``zope.interface.implementer`` class decorator.
......
......@@ -41,6 +41,7 @@ setup(name='transaction',
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
],
author="Zope Corporation",
author_email="zodb-dev@zope.org",
......
......@@ -27,12 +27,12 @@ We can use it with a manager:
>>> dm.last_note
'test 3'
>>> with transaction.manager:
>>> with transaction.manager: #doctest ELLIPSIS
... dm['z'] = 4
... xxx
Traceback (most recent call last):
...
NameError: name 'xxx' is not defined
NameError: ... name 'xxx' is not defined
>>> dm['z']
3
......
......@@ -82,7 +82,7 @@ way, it rolls back all of its changes and prints the error:
... print("%s %s" % ('Updated', name))
... except Exception as error:
... savepoint.rollback()
... print("%s %s" % ('Unexpected exception', error))
... print("%s" % ('Unexpected exception'))
Now let's try applying some entries:
......@@ -117,7 +117,7 @@ If we provide entries that cause an unexpected error:
... ])
Updated bob
Updated sally
Unexpected exception unsupported operand type(s) for +=: 'float' and 'str'
Unexpected exception
Because the apply_entries used a savepoint for the entire function, it was
able to rollback the partial changes without rolling back changes made in the
......
......@@ -36,7 +36,7 @@ TODO
add in tests for objects which are modified multiple times,
for example an object that gets modified in multiple sub txns.
"""
from doctest import DocTestSuite, DocFileSuite
from doctest import DocTestSuite, DocFileSuite, IGNORE_EXCEPTION_DETAIL
import struct
import sys
......@@ -769,7 +769,8 @@ def test_suite():
unittest.makeSuite(Test_oid_repr),
))
if sys.version_info >= (2, 6):
suite.addTest(DocFileSuite('convenience.txt'))
suite.addTest(DocFileSuite('convenience.txt',
optionflags=IGNORE_EXCEPTION_DETAIL))
return suite
......
......@@ -28,6 +28,7 @@ class WeakSetTests(unittest.TestCase):
self.assertEqual(dummy2 in w, False)
def test_len(self):
import gc
w = WeakSet()
d1 = Dummy()
d2 = Dummy()
......@@ -35,6 +36,7 @@ class WeakSetTests(unittest.TestCase):
w.add(d2)
self.assertEqual(len(w), 2)
del d1
gc.collect()
self.assertEqual(len(w), 1)
def test_remove(self):
......@@ -46,6 +48,7 @@ class WeakSetTests(unittest.TestCase):
self.assertEqual(dummy in w, False)
def test_as_weakref_list(self):
import gc
w = WeakSet()
dummy = Dummy()
dummy2 = Dummy()
......@@ -54,6 +57,7 @@ class WeakSetTests(unittest.TestCase):
w.add(dummy2)
w.add(dummy3)
del dummy3
gc.collect()
L = [x() for x in w.as_weakref_list()]
# L is a list, but it does not have a guaranteed order.
self.assertTrue(list, type(L))
......
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