Skip to content

Commit

Permalink
Python 3 checkpoint.
Browse files Browse the repository at this point in the history
Working on converting away from zope.app.testing and standardizing the
test setup.
  • Loading branch information
jamadden committed May 16, 2017
1 parent 46087f8 commit b5ec7c7
Show file tree
Hide file tree
Showing 53 changed files with 821 additions and 585 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/
.coverage
htmlcov/
27 changes: 21 additions & 6 deletions .travis.yml
@@ -1,11 +1,26 @@
language: python
sudo: false
python:
- 2.7
install:
- python bootstrap.py
- bin/buildout
- 2.7
- 3.4
- 3.5
- 3.6
- pypy-5.4.1
script:
- bin/test -v1 --ndiff
- 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
4 changes: 3 additions & 1 deletion CHANGES.txt → CHANGES.rst
Expand Up @@ -2,9 +2,11 @@
CHANGES
=======

3.7.6 (unreleased)
4.0.0 (unreleased)
------------------

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

- Modernize some of the templates. An increment towards having
zope.app.apidoc compatible with Chameleon.

Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions setup.cfg
@@ -0,0 +1,2 @@
[bdist_wheel]
universal = 1
133 changes: 78 additions & 55 deletions setup.py
Expand Up @@ -18,67 +18,99 @@
##############################################################################
"""Setup for zope.app.apidoc 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()

static_requires = [
'mechanize >= 0.1.8',
'zope.securitypolicy',
'zope.app.securitypolicy',
]

tests_require = [
'zope.app.securitypolicy',
'zope.browserpage >= 4.1.0',
'zope.securitypolicy',
'zope.login',
'zope.testing',
'zope.testrunner',
'zope.principalannotation',
'zope.app.http',
'zope.app.rotterdam >= 4.0.0',
'zope.app.principalannotation',
'zope.app.folder >= 4.0.0',
'zope.applicationcontrol >= 4.0.0',
'zope.app.wsgi',
] + static_requires

setup(
name = 'zope.app.apidoc',
name='zope.app.apidoc',
version='3.7.6dev',
author = 'Zope Corporation and Contributors',
author_email = 'zope-dev@zope.org',
description = 'API Documentation and Component Inspection for Zope 3',
author='Zope Corporation and Contributors',
author_email='zope-dev@zope.org',
description='API Documentation and Component Inspection for Zope 3',
long_description=(
read('README.txt')
read('README.rst')
+ '\n\n.. contents::\n\n' +
read('src', 'zope', 'app', 'apidoc', 'README.txt')
read('src', 'zope', 'app', 'apidoc', 'README.rst')
+ '\n\n' +
read('src', 'zope', 'app', 'apidoc', 'component.txt')
read('src', 'zope', 'app', 'apidoc', 'component.rst')
+ '\n\n' +
read('src', 'zope', 'app', 'apidoc', 'interface.txt')
read('src', 'zope', 'app', 'apidoc', 'interface.rst')
+ '\n\n' +
read('src', 'zope', 'app', 'apidoc', 'presentation.txt')
read('src', 'zope', 'app', 'apidoc', 'presentation.rst')
+ '\n\n' +
read('src', 'zope', 'app', 'apidoc', 'utilities.txt')
read('src', 'zope', 'app', 'apidoc', 'utilities.rst')
+ '\n\n' +
read('src', 'zope', 'app', 'apidoc', 'classregistry.txt')
read('src', 'zope', 'app', 'apidoc', 'classregistry.rst')
+ '\n\n' +
read('CHANGES.txt')
),
license = "ZPL 2.1",
keywords = "zope3 api documentation",
classifiers = [
read('CHANGES.rst')
),
license="ZPL 2.1",
keywords="zope3 api documentation",
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License',
'Programming Language :: Python',
'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.apidoc',
packages = find_packages('src'),
include_package_data = True,
package_dir = {'':'src'},
namespace_packages = ['zope', 'zope.app'],
install_requires = [
'ZODB3>=3.8.0',
'Framework :: Zope3',
],
url='http://github.com/zopefoundation/zope.app.apidoc',
packages=find_packages('src'),
include_package_data=True,
package_dir={'': 'src'},
namespace_packages=['zope', 'zope.app'],
install_requires=[
'persistent',
'ZODB',
'setuptools',
'zope.annotation',
'zope.app.appsetup',
'zope.app.basicskin',
'zope.app.exception',
'zope.app.onlinehelp',
'zope.app.preference',
'zope.app.appsetup >= 4.0.0',
'zope.app.basicskin >= 4.0.0',
'zope.app.exception >= 4.0.0',
'zope.app.onlinehelp >= 4.0.0.dev0',
'zope.app.preference >= 4.0.0.dev0',
'zope.app.publisher',
'zope.app.renderer',
'zope.app.testing',
'zope.app.tree',
'zope.app.renderer >= 4.0.0.dev0',
'zope.app.tree >= 4.0.0',
'zope.cachedescriptors',
'zope.component>=3.8.0',
'zope.configuration',
Expand All @@ -87,32 +119,23 @@ def read(*rnames):
'zope.hookable',
'zope.i18n',
'zope.interface',
'zope.location>=3.7.0',
'zope.location >= 4.0.3',
'zope.proxy',
'zope.publisher>=3.12.0',
'zope.publisher >= 4.3.1',
'zope.schema',
'zope.security',
'zope.site',
'zope.testbrowser',
'zope.testing',
'zope.traversing>=3.5.0',
],
extras_require = dict(
test=['zope.app.testing',
'zope.app.securitypolicy',
'zope.app.zcmlfiles',
'zope.browserpage>=3.10.1',
'zope.securitypolicy',
'zope.login',],
static=['mechanize >= 0.1.8',
'zope.securitypolicy',
'zope.app.zcmlfiles',
'zope.app.securitypolicy',
],
),
entry_points = """
'zope.traversing >= 4.1.0',
],
extras_require={
'test': tests_require,
'static': static_requires,
},
entry_points="""
[console_scripts]
static-apidoc = zope.app.apidoc.static:main
""",
zip_safe = False,
)
""",
zip_safe=False,
)
8 changes: 1 addition & 7 deletions src/zope/__init__.py
@@ -1,7 +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
8 changes: 1 addition & 7 deletions src/zope/app/__init__.py
@@ -1,7 +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
File renamed without changes.
6 changes: 3 additions & 3 deletions src/zope/app/apidoc/apidoc.py
Expand Up @@ -13,27 +13,27 @@
##############################################################################
"""Zope 3 API Documentation
$Id$
"""
from __future__ import absolute_import
__docformat__ = 'restructuredtext'

import zope.component
from zope.interface import implements
from zope.interface import implementer
from zope.publisher.browser import applySkin
from zope.location import locate
from zope.location.interfaces import ILocation

from zope.app.apidoc.interfaces import IDocumentationModule
from zope.app.apidoc.utilities import ReadContainerBase

@implementer(ILocation)
class APIDocumentation(ReadContainerBase):
"""Represent the complete API Documentation.
This documentation is implemented using a simply `IReadContainer`. The
items of the container are all registered utilities for
`IDocumentationModule`.
"""
implements(ILocation)

def __init__(self, parent, name):
self.__parent__ = parent
Expand Down
Expand Up @@ -4,7 +4,7 @@ Generic API Doc Views

Get a browser started:

>>> from zope.testbrowser.testing import Browser
>>> from zope.testbrowser.wsgi import Browser
>>> browser = Browser()
>>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')

Expand Down Expand Up @@ -38,4 +38,3 @@ feel better and does not have all the O-wrap clutter:
<a href="mailto:zope-dev@zope.org">zope-dev@zope.org</a>.
</p>
...

8 changes: 5 additions & 3 deletions src/zope/app/apidoc/browser/configure.zcml
Expand Up @@ -4,6 +4,8 @@
xmlns:zcml="http://namespaces.zope.org/zcml"
i18n_domain="zope">

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

<!-- BBB 2006/02/18, to be removed after 12 months -->
<layer
zcml:condition="have deprecatedlayers"
Expand Down Expand Up @@ -141,23 +143,23 @@

<page
name="apidocTree"
for="zope.app.preference.interfaces.IPreferenceGroup"
for="zope.preference.interfaces.IPreferenceGroup"
class=".preference.APIDocPreferencesTree"
permission="zope.View"
attribute="apidocTree"
layer=".skin.apidoc"
/>

<page
for="zope.app.preference.interfaces.IPreferenceGroup"
for="zope.preference.interfaces.IPreferenceGroup"
permission="zope.Public"
name="apidocMenu.html"
template="prefmenu.pt"
layer=".skin.apidoc"
/>

<page
for="zope.app.preference.interfaces.IPreferenceGroup"
for="zope.preference.interfaces.IPreferenceGroup"
permission="zope.Public"
name="apidocIndex.html"
template="prefIndex.pt"
Expand Down
5 changes: 4 additions & 1 deletion src/zope/app/apidoc/browser/disabled.zcml
Expand Up @@ -3,6 +3,10 @@
xmlns:zope="http://namespaces.zope.org/zope"
i18n_domain="zope">

<include package="zope.browserpage" file="meta.zcml" />
<!-- defaultView directive -->
<include package="zope.publisher" file="meta.zcml" />

<page
for="..disabled.APIDocStub"
name="index.html"
Expand All @@ -16,4 +20,3 @@
/>

</configure>

Expand Up @@ -9,7 +9,7 @@ informing the user that the API docs are disabled. We do this as we changed
the default during the release of Zope 3.3 and many developers will still
assume that their instances are running in developer mode, while they aren't.

>>> from zope.testbrowser.testing import Browser
>>> from zope.testbrowser.wsgi import Browser
>>> browser = Browser()
>>> browser.handleErrors = False
>>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
Expand Down
1 change: 0 additions & 1 deletion src/zope/app/apidoc/browser/skin.py
Expand Up @@ -13,7 +13,6 @@
##############################################################################
"""`APIdoc` skin.
$Id$
"""
__docformat__ = "reStructuredText"

Expand Down

0 comments on commit b5ec7c7

Please sign in to comment.