From 94394e8dd9c830f8c6e8312db66d21c19aae0a8b Mon Sep 17 00:00:00 2001 From: Jason Madden Date: Tue, 16 Oct 2018 09:45:28 -0500 Subject: [PATCH] Fix deprecation warnings and add Python 3.7 Also drop Python 3.3 Fixes #16 --- .travis.yml | 8 +++-- CHANGES.rst | 39 ++++++++++++----------- setup.py | 4 +-- src/zope/annotation/attribute.py | 7 +++- src/zope/annotation/tests/test_factory.py | 7 ++-- tox.ini | 2 +- 6 files changed, 41 insertions(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2089701..67d7a48 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,11 +2,15 @@ language: python sudo: false python: - 2.7 - - 3.3 - 3.4 - 3.5 - 3.6 - - pypy-5.4.1 + - pypy +matrix: + include: + - python: "3.7" + dist: xenial + sudo: true install: - pip install -U pip setuptools zope.testrunner - pip install -U coveralls coverage diff --git a/CHANGES.rst b/CHANGES.rst index c273afc..4faa6d4 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,14 +1,17 @@ -Changes -======= +========= + Changes +========= -4.6.1 (unreleased) ------------------- +4.7.0 (unreleased) +================== -- Nothing changed yet. +- Add support for Python 3.7 and drop support for Python 3.3. +- Fix a DeprecationWarning from ``zope.annotation.attribute``. See + `issue 16 `_. 4.6.0 (2017-09-22) ------------------- +================== - Make ``AttributeAnnotations`` have a ``__parent__``. The ``__parent__`` is the object that it stores ``__annotations__`` on. @@ -18,7 +21,7 @@ Changes 4.5 (2017-06-03) ----------------- +================ - Drop support for Python 2.6. @@ -31,14 +34,14 @@ Changes ``UserDict.DictMixin``. 4.4.1 (2015-01-09) ------------------- +================== - Convert doctests to Sphinx documentation. Doctest snippets are still tested via ``tox -e docs``. 4.4.0 (2015-01-09) ------------------- +================== - LP #98462: add additional "iterable mapping" methods to ``IAnnotations``. @@ -52,27 +55,27 @@ Changes using ``dict`` for attribute storage if ``BTrees`` is not importable. 4.3.0 (2014-12-26) ------------------- +================== - Add support for Python 3.4. 4.2.0 (2013-03-18) ------------------- +================== - Don't make AttributeAnnotations available as a view. 4.1.0 (2013-02-24) ------------------- +================== - Add ``__bool__`` method to ``IAnnotations`` API for Python 3 compatibility. 4.0.1 (2013-02-11) ------------------- +================== - Add `tox.ini`. 4.0.0 (2013-02-11) ------------------- +================== - Add support for Python 3.3 and PyPy. @@ -88,7 +91,7 @@ Changes via a zcml extra, added tests for zcml. 3.5.0 (2009-09-07) ------------------- +================== - Add ZODB3 to install_requires, because it's a true requirement of this package, not just a testing requirement, as BTrees are in use. @@ -97,7 +100,7 @@ Changes a mistake. 3.4.2 (2009-03-09) ------------------- +================== - Clean up package description and documentation a bit. @@ -107,14 +110,14 @@ Changes - Remove old zpkg-related files. 3.4.1 (2008-08-26) ------------------- +================== - Annotation factories take care not to store proxies in the database, so adapting an object wrapped in a ``LocationProxy`` works correctly. Fixes https://bugs.launchpad.net/zope3/+bug/261620 3.4.0 (2007-08-29) ------------------- +================== - Annotation factories are no longer containing the factored object. Instead the objects are located using ``zope.location``. This removes diff --git a/setup.py b/setup.py index 89d77da..38d67d4 100644 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ def read(*rnames): setup( name='zope.annotation', - version='4.6.1.dev0', + version='4.7.0.dev0', url='https://github.com/zopefoundation/zope.annotation', license='ZPL 2.1', description='Object annotation mechanism', @@ -49,10 +49,10 @@ def read(*rnames): 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Natural Language :: English', diff --git a/src/zope/annotation/attribute.py b/src/zope/annotation/attribute.py index aa7bc0d..5c009ce 100644 --- a/src/zope/annotation/attribute.py +++ b/src/zope/annotation/attribute.py @@ -13,7 +13,12 @@ ############################################################################## """Attribute Annotations implementation""" import logging -from collections import MutableMapping as DictMixin + +try: + from collections.abc import MutableMapping as DictMixin +except ImportError: + # Python 2 + from collections import MutableMapping as DictMixin try: from BTrees.OOBTree import OOBTree as _STORAGE diff --git a/src/zope/annotation/tests/test_factory.py b/src/zope/annotation/tests/test_factory.py index cc909c2..2cf7367 100644 --- a/src/zope/annotation/tests/test_factory.py +++ b/src/zope/annotation/tests/test_factory.py @@ -40,9 +40,12 @@ class Context(dict): class TestFactory(unittest.TestCase): + assertRaisesRegex = getattr(unittest.TestCase, 'assertRaisesRegex', + getattr(unittest.TestCase, 'assertRaisesRegexp')) + def test_no_adapts(self): - self.assertRaisesRegexp(TypeError, "Missing.*on annotation", - factory, TestFactory) + self.assertRaisesRegex(TypeError, "Missing.*on annotation", + factory, TestFactory) def test_factory_no_location(self): diff --git a/tox.ini b/tox.ini index 674a5ce..95148bd 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,10 @@ [tox] envlist = py27, - py33, py34, py35, py36, + py37, pypy, pypy3, nobtree,