Skip to content

Commit

Permalink
Python 3.4/5/6 and PyPy support.
Browse files Browse the repository at this point in the history
- 100% test coverage
- Make sure the configurations can be loaded
- Enable coverage reporting
- Rename .txt -> .rst
- A 'browser' extra contains what's needed to load the browser
  configuration, which is now conditional.
  • Loading branch information
jamadden committed May 12, 2017
1 parent 39875f4 commit aeb72e8
Show file tree
Hide file tree
Showing 19 changed files with 315 additions and 71 deletions.
7 changes: 7 additions & 0 deletions .coveragerc
@@ -0,0 +1,7 @@
[run]
source = src

[report]
exclude_lines =
pragma: no cover
if __name__ == '__main__':
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -9,3 +9,5 @@ build/
dist/
*.egg-info/
.tox/
htmlcov/
.coverage
26 changes: 21 additions & 5 deletions .travis.yml
@@ -1,9 +1,25 @@
language: python
sudo: false
python:
- 2.7
install:
- pip install .
- 2.7
- 3.5
- 3.6
- pypy-5.4.1
script:
- python setup.py test -q
- coverage run -m zope.testrunner --test-path=src --auto-color --auto-progress

after_success:
- coveralls
notifications:
email: false
email: false

install:
- pip install -U pip setuptools
- pip install -U coveralls coverage
- pip install -U -e ".[test]"


cache: pip

before_cache:
- rm -f $HOME/.cache/pip/log/debug.log
6 changes: 3 additions & 3 deletions CHANGES.txt → CHANGES.rst
Expand Up @@ -2,10 +2,10 @@
CHANGES
=======

3.5.4 (unreleased)
4.0.0 (unreleased)
------------------

- Nothing changed yet.
- Add support for Python 3.4, 3.5, 3.6 and PyPy.


3.5.3 (2010-09-01)
Expand All @@ -28,7 +28,7 @@ CHANGES

- Use zope.ManageServices permission instead of zope.ManageContent
for errorRedirect view and menu item, because all IErrorReportingUtility
views are registered for zope.ManageServices as well.
views are registered for zope.ManageServices as well.

- Fix package's README.txt

Expand Down
7 changes: 6 additions & 1 deletion MANIFEST.in
@@ -1,7 +1,12 @@
include *.py
include *.txt
include *.rst
include buildout.cfg
include .travis.yml
include .coveragerc
include tox.ini

recursive-include src *.gif
recursive-include src *.pt
recursive-include src *.txt
recursive-include src *.rst
recursive-include src *.zcml
File renamed without changes.
2 changes: 2 additions & 0 deletions setup.cfg
@@ -0,0 +1,2 @@
[bdist_wheel]
universal = 1
72 changes: 49 additions & 23 deletions setup.py
Expand Up @@ -18,51 +18,77 @@
##############################################################################
"""Setup for zope.app.error package
$Id$
"""

import os

from setuptools import setup, find_packages

def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
with open(os.path.join(os.path.dirname(__file__), *rnames)) as f:
return f.read()

setup(name='zope.app.error',
version='3.5.4dev',
version='4.0.0.dev0',
author='Zope Corporation and Contributors',
author_email='zope-dev@zope.org',
description = "Error reporting utility management UI for Zope3",
description="Error reporting utility management UI for Zope3",
long_description=(
read('README.txt')
read('README.rst')
+ '\n\n' +
read('CHANGES.txt')
read('src','zope', 'app', 'error', 'README.rst')
+ '\n\n' +
read('CHANGES.rst')
),
license='ZPL 2.1',
keywords = "zope3 error reporting utility views UI",
classifiers = [
keywords="zope3 error reporting utility views UI",
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 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',
'Natural Language :: English',
'Operating System :: OS Independent',
'Topic :: Internet :: WWW/HTTP',
'Framework :: Zope3'],
url='http://pypi.python.org/pypi/zope.app.error',
'Framework :: Zope3',
],
url='http://github.com/zopefoundation/zope.app.error',
packages=find_packages('src'),
package_dir = {'': 'src'},
extras_require=dict(
test=['zope.app.testing']),
package_dir={'': 'src'},
extras_require={
'test': [
'zope.testing',
'zope.testrunner',
'zope.browserpage',
'zope.browsermenu',
'zope.browserresource',
],
'browser': [
'zope.browsermenu',
'zope.browserpage',
'zope.browserresource',
],
},
namespace_packages=['zope', 'zope.app'],
install_requires=['setuptools',
'zope.component',
'zope.error',
'zope.publisher',
'zope.traversing',
],
include_package_data = True,

zip_safe = False,
)
install_requires=[
'setuptools',
# zope.error has an undeclared dependency on zope.annotation
'zope.annotation',
'zope.component',
'zope.error',
'zope.publisher',
'zope.security',
'zope.traversing',
],
include_package_data=True,
zip_safe=False,
)
9 changes: 1 addition & 8 deletions src/zope/__init__.py
@@ -1,8 +1 @@
# this is a namespace package
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)

__import__('pkg_resources').declare_namespace(__name__) # pragma: no cover
9 changes: 1 addition & 8 deletions src/zope/app/__init__.py
@@ -1,8 +1 @@
# this is a namespace package
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)

__import__('pkg_resources').declare_namespace(__name__) # pragma: no cover
57 changes: 57 additions & 0 deletions src/zope/app/error/README.rst
@@ -0,0 +1,57 @@
======
README
======

This package provides an error reporting utility which is able to
store errors. (Notice that the implementation classes have been moved
to the ``zope.error`` package.)

Let's create one:

>>> from zope.app.error.error import ErrorReportingUtility
>>> util = ErrorReportingUtility()
>>> util
<zope.error.error.ErrorReportingUtility object at ...>

>>> from zope.app.error.interfaces import IErrorReportingUtility
>>> IErrorReportingUtility.providedBy(util)
True
>>> IErrorReportingUtility
<InterfaceClass zope.error.interfaces.IErrorReportingUtility>

This package contains ZMI views in the ``browser`` sub-package:

>>> from zope.app.error.browser import EditErrorLog, ErrorRedirect
>>> EditErrorLog
<class 'zope.app.error.browser.EditErrorLog'>
>>> ErrorRedirect
<class 'zope.app.error.browser.ErrorRedirect'>

These are configured when the configuration for this package is
executed (as long as the right dependencies are available).

Certain ZMI menus must first be available:

>>> from zope.configuration import xmlconfig
>>> _ = xmlconfig.string(r"""
... <configure xmlns="http://namespaces.zope.org/browser" i18n_domain="zope">
... <include package="zope.browsermenu" file="meta.zcml" />
... <menu
... id="zmi_views"
... title="Views"
... />
...
... <menu
... id="zmi_actions"
... title="Actions"
... />
... </configure>
... """)

Now we can configure the package:

>>> _ = xmlconfig.string(r"""
... <configure xmlns="http://namespaces.zope.org/zope">
... <include package="zope.app.error" />
... </configure>
... """)
15 changes: 0 additions & 15 deletions src/zope/app/error/README.txt

This file was deleted.

2 changes: 0 additions & 2 deletions src/zope/app/error/browser/__init__.py
Expand Up @@ -12,8 +12,6 @@
#
##############################################################################
"""Define view component for event utility control.
$Id$
"""
from zope.component import getUtility
from zope.publisher.browser import BrowserView
Expand Down
12 changes: 10 additions & 2 deletions src/zope/app/error/browser/configure.zcml
@@ -1,6 +1,15 @@
<zope:configure
xmlns:zope="http://namespaces.zope.org/zope"
xmlns="http://namespaces.zope.org/browser">
xmlns:zcml="http://namespaces.zope.org/zcml"
xmlns="http://namespaces.zope.org/browser"
i18n_domain="zope">

<include package="zope.browserpage" file="meta.zcml" />
<include package="zope.browserresource" file="meta.zcml" />
<include package="zope.browsermenu" file="meta.zcml" />

<include package="zope.traversing" />
<include package="zope.traversing.browser" />

<page
for="*"
Expand Down Expand Up @@ -39,4 +48,3 @@
file="error.gif" />

</zope:configure>

22 changes: 22 additions & 0 deletions src/zope/app/error/browser/ftesting.zcml
@@ -0,0 +1,22 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
i18n_domain="zope">

<include package="zope.browsermenu" file="meta.zcml" />

<browser:menu
id="zmi_views"
title="Views"
description="Menu for displaying alternate representations of an object"
/>

<browser:menu
id="zmi_actions"
title="Actions"
description="Menu for displaying actions to be performed"
/>

<include package="zope.app.error" />

</configure>

0 comments on commit aeb72e8

Please sign in to comment.