[Checkins] SVN: zope.annotation/trunk/ Added support for Python 3.3 and PyPy 1.9.
Stephen Richter
cvs-admin at zope.org
Mon Feb 11 18:05:58 UTC 2013
Log message for revision 129275:
Added support for Python 3.3 and PyPy 1.9.
I could not verify 100% test coverage, because for some reason nose did
not detect our factory code peoperly. But otherwise the port was smooth.
Changed:
_U zope.annotation/trunk/
U zope.annotation/trunk/CHANGES.txt
U zope.annotation/trunk/buildout.cfg
U zope.annotation/trunk/setup.py
U zope.annotation/trunk/src/zope/annotation/README.txt
U zope.annotation/trunk/src/zope/annotation/attribute.py
U zope.annotation/trunk/src/zope/annotation/tests/test_attributeannotations.py
U zope.annotation/trunk/src/zope/annotation/tests/test_configure.py
-=-
Property changes on: zope.annotation/trunk
___________________________________________________________________
Modified: svn:ignore
- bin
build
dist
lib
develop-eggs
eggs
parts
.installed.cfg
+ .coverage
.installed.cfg
.tox
bin
build
dist
lib
develop-eggs
eggs
parts
*.xml
Modified: zope.annotation/trunk/CHANGES.txt
===================================================================
--- zope.annotation/trunk/CHANGES.txt 2013-02-11 17:21:10 UTC (rev 129274)
+++ zope.annotation/trunk/CHANGES.txt 2013-02-11 18:05:58 UTC (rev 129275)
@@ -5,6 +5,8 @@
4.0.0 (unreleased)
------------------
+- Added support for Python 3.3 and PyPy 1.9.
+
- Replaced deprecated ``zope.component.adapts`` usage with equivalent
``zope.component.adapter`` decorator.
Modified: zope.annotation/trunk/buildout.cfg
===================================================================
--- zope.annotation/trunk/buildout.cfg 2013-02-11 17:21:10 UTC (rev 129274)
+++ zope.annotation/trunk/buildout.cfg 2013-02-11 18:05:58 UTC (rev 129275)
@@ -1,15 +1,11 @@
[buildout]
-develop = .
+develop = .
parts = test pydev
[test]
recipe = zc.recipe.testrunner
eggs = zope.annotation [test,zcml]
-[ctags]
-recipe = z3c.recipe.tag:tags
-eggs = zope.annotation
-
[pydev]
recipe = pb.recipes.pydev
eggs = zope.annotation
Modified: zope.annotation/trunk/setup.py
===================================================================
--- zope.annotation/trunk/setup.py 2013-02-11 17:21:10 UTC (rev 129274)
+++ zope.annotation/trunk/setup.py 2013-02-11 18:05:58 UTC (rev 129275)
@@ -18,13 +18,27 @@
##############################################################################
"""Setup for zope.annotation package
"""
-
import os
+import sys
from setuptools import setup, find_packages
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+def alltests():
+ # use the zope.testrunner machinery to find all the
+ # test suites we've put under ourselves
+ from zope.testrunner.options import get_options
+ from zope.testrunner.find import find_suites
+ from unittest import TestSuite
+ here = os.path.abspath(os.path.dirname(sys.argv[0]))
+ args = sys.argv[:]
+ src = os.path.join(here, 'src')
+ defaults = ['--test-path', src]
+ options = get_options(args, defaults)
+ suites = list(find_suites(options))
+ return TestSuite(suites)
+
setup(
name='zope.annotation',
version='4.0.0dev',
@@ -41,32 +55,47 @@
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.3',
+ 'Programming Language :: Python :: Implementation :: CPython',
+ 'Programming Language :: Python :: Implementation :: PyPy',
'Natural Language :: English',
'Operating System :: OS Independent',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Software Development',
],
long_description= \
- read('src', 'zope', 'annotation', 'README.txt')
+ read('src', 'zope', 'annotation', 'README.txt')
+ '\n\n' +
read('CHANGES.txt'),
packages=find_packages('src'),
package_dir={'': 'src'},
namespace_packages=['zope',],
- install_requires=['setuptools',
- 'zope.interface',
- 'zope.component',
- 'zope.location',
- 'zope.proxy',
- 'ZODB3',
- ],
+ install_requires=[
+ 'BTrees',
+ 'setuptools',
+ 'zope.interface',
+ 'zope.component',
+ 'zope.location',
+ 'zope.proxy',
+ ],
extras_require=dict(
- test=['zope.testing'],
+ test=[
+ 'persistent',
+ 'zope.testing'
+ ],
zcml=[
'zope.component[zcml]',
'zope.configuration',
],
),
+ test_suite="__main__.alltests",
+ tests_require=[
+ 'persistent',
+ 'zope.component[zcml]',
+ 'zope.configuration',
+ 'zope.testrunner',
+ 'zope.testing'],
include_package_data=True,
zip_safe=False,
)
Modified: zope.annotation/trunk/src/zope/annotation/README.txt
===================================================================
--- zope.annotation/trunk/src/zope/annotation/README.txt 2013-02-11 17:21:10 UTC (rev 129274)
+++ zope.annotation/trunk/src/zope/annotation/README.txt 2013-02-11 18:05:58 UTC (rev 129275)
@@ -29,7 +29,7 @@
subdirective of the `content` or `class` directive.
Now let's create an annotation for this:
-
+
>>> class IBar(interface.Interface):
... a = interface.Attribute('A')
... b = interface.Attribute('B')
@@ -164,14 +164,14 @@
but that's because we received a LocationProxy
- >>> print type(located_polloi).__name__
- LocationProxy
+ >>> type(located_polloi).__name__
+ 'LocationProxy'
If we unwrap located_polloi and look at it directly, we'll see it stores a
reference to the real Foo object
>>> from zope.proxy import removeAllProxies
- >>> removeAllProxies(located_polloi).__parent__ is foo4
+ >>> removeAllProxies(located_polloi).__parent__ == foo4
True
>>> removeAllProxies(located_polloi).__name__
'my.other.key'
Modified: zope.annotation/trunk/src/zope/annotation/attribute.py
===================================================================
--- zope.annotation/trunk/src/zope/annotation/attribute.py 2013-02-11 17:21:10 UTC (rev 129274)
+++ zope.annotation/trunk/src/zope/annotation/attribute.py 2013-02-11 18:05:58 UTC (rev 129275)
@@ -11,16 +11,17 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""Attribute Annotations implementation
-"""
-__docformat__ = 'restructuredtext'
-
-from UserDict import DictMixin
+"""Attribute Annotations implementation"""
from BTrees.OOBTree import OOBTree
from zope import component, interface
from zope.annotation import interfaces
+try:
+ from UserDict import DictMixin
+except ImportError:
+ from collections import MutableMapping as DictMixin
+
@interface.implementer(interfaces.IAnnotations)
@component.adapter(interfaces.IAttributeAnnotatable)
class AttributeAnnotations(DictMixin):
@@ -58,6 +59,20 @@
return annotations.keys()
+ def __iter__(self):
+ annotations = getattr(self.obj, '__annotations__', None)
+ if annotations is None:
+ return iter([])
+
+ return iter(annotations)
+
+ def __len__(self):
+ annotations = getattr(self.obj, '__annotations__', None)
+ if annotations is None:
+ return 0
+
+ return len(annotations)
+
def __setitem__(self, key, value):
"""See zope.annotation.interfaces.IAnnotations"""
try:
Modified: zope.annotation/trunk/src/zope/annotation/tests/test_attributeannotations.py
===================================================================
--- zope.annotation/trunk/src/zope/annotation/tests/test_attributeannotations.py 2013-02-11 17:21:10 UTC (rev 129274)
+++ zope.annotation/trunk/src/zope/annotation/tests/test_attributeannotations.py 2013-02-11 18:05:58 UTC (rev 129275)
@@ -14,14 +14,20 @@
"""Tests the 'AttributeAnnotations' adapter. Also test the annotation
factory.
"""
-import unittest, doctest
-from zope.testing import cleanup
+import unittest, doctest, re
+from zope.testing import cleanup, renormalizing
from zope.interface import implementer
from zope import component
from zope.annotation.tests.annotations import AnnotationsTest
from zope.annotation.attribute import AttributeAnnotations
from zope.annotation.interfaces import IAttributeAnnotatable
+checker = renormalizing.RENormalizing([
+ # PyPy has a different default object repr.
+ (re.compile(r"<__builtin__\.(.*?) object"),
+ r'<\1 object'),
+ ])
+
@implementer(IAttributeAnnotatable)
class Dummy(object):
pass
@@ -44,7 +50,7 @@
return unittest.TestSuite((
unittest.makeSuite(AttributeAnnotationsTest),
doctest.DocFileSuite('../README.txt', setUp=setUp, tearDown=tearDown,
- optionflags=doctest.ELLIPSIS)
+ optionflags=doctest.ELLIPSIS, checker=checker)
))
if __name__=='__main__':
Modified: zope.annotation/trunk/src/zope/annotation/tests/test_configure.py
===================================================================
--- zope.annotation/trunk/src/zope/annotation/tests/test_configure.py 2013-02-11 17:21:10 UTC (rev 129274)
+++ zope.annotation/trunk/src/zope/annotation/tests/test_configure.py 2013-02-11 18:05:58 UTC (rev 129275)
@@ -24,8 +24,8 @@
try:
zope.configuration.xmlconfig.XMLConfig(
'configure.zcml', zope.annotation)()
- except Exception, e:
- self.fail(e)
+ except Exception as err:
+ self.fail(err)
def test_configure_should_register_n_components(self):
gsm = zope.component.getGlobalSiteManager()
More information about the checkins
mailing list