diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..8f0d530 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,8 @@ +[run] +source = zope.dublincore + +[report] +exclude_lines = + pragma: no cover + if __name__ == '__main__': + raise NotImplementedError diff --git a/.travis.yml b/.travis.yml index 171bbb4..7a19e39 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,15 +2,22 @@ language: python sudo: false python: - 2.7 - - 3.3 - 3.4 - 3.5 - - pypy - - pypy3 + - 3.6 + - pypy-5.6.0 + - pypy3.5-5.5-alpha install: - - pip install . - - pip install zope.dublincore[test] + - pip install -U pip setuptools + - pip install -U coverage coveralls + - pip install -U -e .[test,docs] script: - - python setup.py -q test -q + - coverage run -m zope.testrunner --test-path=src + - coverage run -a -m sphinx -b doctest -d docs/_build/doctrees docs docs/_build/doctest +after_success: + - coveralls notifications: email: false +cache: pip +before_cache: + - rm -f $HOME/.cache/pip/log/debug.log diff --git a/CHANGES.rst b/CHANGES.rst index 51f68b4..176eef4 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,15 +4,14 @@ Changes 4.2.0 (Unreleased) ------------------ -- Add support for Python 3.5. +- Add support for Python 3.5 and 3.6. -- Drop support for Python 2.6. +- Drop support for Python 2.6 and 3.3. - Convert doctests to Sphinx, including building docs and testing doctest snippets under ``tox``. - 4.1.1 (2014-01-10) ------------------ diff --git a/MANIFEST.in b/MANIFEST.in index f720ab1..fe7dac5 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,7 +3,14 @@ include *.txt include bootstrap.py include buildout.cfg include tox.ini +include .travis.yml +include .coveragerc recursive-include src * +recursive-include docs *.bat +recursive-include docs *.py +recursive-include docs *.rst +recursive-include docs Makefile + global-exclude *.pyc diff --git a/README.rst b/README.rst index 4e54faf..f86c974 100644 --- a/README.rst +++ b/README.rst @@ -12,6 +12,11 @@ :target: http://zopedublincore.readthedocs.org/en/latest/ :alt: Documentation Status +.. image:: https://coveralls.io/repos/github/zopefoundation/zope.dublincore/badge.svg?branch=master + :target: https://coveralls.io/github/zopefoundation/zope.dublincore?branch=master + + + This package provides a Dublin Core support for Zope-based web applications. This includes: diff --git a/docs/narrative.rst b/docs/narrative.rst index ec0efb2..cfe80f7 100644 --- a/docs/narrative.rst +++ b/docs/narrative.rst @@ -31,16 +31,16 @@ by simply defining a property as DCProperty. ... authors = property.DCListProperty('creators') >>> obj = DC() >>> obj.title = u'My title' - >>> obj.title - u'My title' + >>> print(obj.title) + My title Let's see if the title is really stored in dublin core: .. doctest:: >>> from zope.dublincore.interfaces import IZopeDublinCore - >>> IZopeDublinCore(obj).title - u'My title' + >>> print(IZopeDublinCore(obj).title) + My title Even if a dublin core property is a list property we can set and get the property as scalar type: @@ -48,20 +48,20 @@ property as scalar type: .. doctest:: >>> obj.author = u'me' - >>> obj.author - u'me' + >>> print(obj.author) + me DCListProperty acts on the list: .. doctest:: - >>> obj.authors - (u'me',) + >>> obj.authors == (u'me',) + True >>> obj.authors = [u'I', u'others'] - >>> obj.authors - (u'I', u'others') - >>> obj.author - u'I' + >>> obj.authors == (u'I', u'others') + True + >>> print(obj.author) + I Dublin Core metadata as content data @@ -117,12 +117,12 @@ object, the value stored on the content object is used: >>> content = Content() >>> adapter = factory(content) - >>> adapter.title - u'' + >>> print(adapter.title) + >>> content.title = u'New Title' - >>> adapter.title - u'New Title' + >>> print(adapter.title) + New Title If we set the relevant Dublin Core field using the adapter, the content object is updated: @@ -130,8 +130,8 @@ content object is updated: .. doctest:: >>> adapter.title = u'Adapted Title' - >>> content.title - u'Adapted Title' + >>> print(content.title) + Adapted Title Dublin Core fields which are not specifically mapped to the content object do not affect the content object: @@ -139,10 +139,10 @@ object do not affect the content object: .. doctest:: >>> adapter.description = u"Some long description." - >>> content.description - u'' - >>> adapter.description - u'Some long description.' + >>> print(content.description) + + >>> print(adapter.description) + Some long description. Using arbitrary field names @@ -182,16 +182,16 @@ We can check the effects of the adapter as before: >>> content = Content() >>> adapter = factory(content) - >>> adapter.description - u'' + >>> print(adapter.description) + >>> content.abstract = u"What it's about." - >>> adapter.description - u"What it's about." + >>> print(adapter.description) + What it's about. >>> adapter.description = u'Change of plans.' - >>> content.abstract - u'Change of plans.' + >>> print(content.abstract) + Change of plans. Limitations diff --git a/setup.cfg b/setup.cfg index f3fc2f1..3c77854 100644 --- a/setup.cfg +++ b/setup.cfg @@ -9,3 +9,6 @@ ignore-files=examples.py [aliases] dev = develop easy_install zope.dublincore[testing] docs = easy_install zope.dublincore[docs] + +[bdist_wheel] +universal = 1 diff --git a/setup.py b/setup.py index 9bff4bc..056e8aa 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,8 @@ import os.path def read(*path): - return open(os.path.join(*path)).read() + '\n\n' + with open(os.path.join(*path)) as f: + return f.read() + '\n\n' def alltests(): import os @@ -48,17 +49,19 @@ def alltests(): 'zope.testing >= 3.8', 'zope.testrunner', 'zope.configuration', - ] + 'BTrees', +] setup( name="zope.dublincore", version='4.2.0.dev0', - url='http://pypi.python.org/pypi/zope.dublincore', + url='http://github.com/zopefoundation/zope.dublincore', license='ZPL 2.1', description='Zope Dublin Core implementation', long_description=long_description, author='Zope Foundation and Contributors', author_email='zope-dev@zope.org', + keywords='metadata dublincore', classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', @@ -69,20 +72,19 @@ def alltests(): '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 :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Internet :: WWW/HTTP', 'Topic :: Software Development', - ], - + ], packages=find_packages('src'), - package_dir={'':'src'}, + package_dir={'': 'src'}, namespace_packages=['zope'], include_package_data=True, - install_requires = [ + install_requires=[ 'persistent', 'pytz', 'setuptools', @@ -95,13 +97,13 @@ def alltests(): 'zope.location', 'zope.schema', 'zope.security[zcml]>=3.8', - ], - test_suite = '__main__.alltests', - tests_require = tests_require, - extras_require = { + ], + test_suite='__main__.alltests', + tests_require=tests_require, + extras_require={ 'testing': tests_require, 'test': tests_require, 'docs': ['Sphinx', 'repoze.sphinx.autointerface'], }, - zip_safe = False - ) + zip_safe=False, +) diff --git a/tox.ini b/tox.ini index 85da707..9cbf02b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,39 +1,26 @@ [tox] envlist = - py27,py33,py34,py35,pypy,pypy3,coverage,docs + py27,py34,py35,py36,pypy,pypy3,docs [testenv] commands = - python setup.py -q test -q -# without explicit deps, setup.py test will download a bunch of eggs into $PWD -# (and it seems I can't use zope.dottedname[testing] here, so forget DRY) + zope-testrunner --test-path=src [] + sphinx-build -b doctest -d {envdir}/.cache/doctrees docs {envdir}/.cache/doctest deps = - persistent - pytz - six - zope.annotation - zope.component[zcml] - zope.configuration - zope.datetime - zope.interface - zope.lifecycleevent - zope.location - zope.schema - zope.security[zcml] - zope.testing - zope.testrunner + .[test,docs] [testenv:coverage] usedevelop = true basepython = python2.7 -commands = - nosetests --with-xunit --with-xcoverage +commands = + coverage run -m zope.testrunner --test-path=src [] + coverage run -a -m sphinx -b doctest -d {envdir}/.cache/doctrees docs {envdir}/.cache/doctest + coverage report deps = {[testenv]deps} - nose coverage - nosexcover + [testenv:docs] basepython = @@ -41,7 +28,3 @@ basepython = commands = sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest -deps = - {[testenv]deps} - Sphinx - repoze.sphinx.autointerface