Skip to content

Commit

Permalink
Add Python 3.6, drop Python 3.3
Browse files Browse the repository at this point in the history
Fixes #3.

Project gardening:

- Add coverage environment and coveralls.
  - Reach 100% coverage.
- Rename .txt -> .rst
- Add badges to README.rst
  • Loading branch information
jamadden committed Oct 16, 2017
1 parent 676adb5 commit b3a8ee2
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 52 deletions.
11 changes: 11 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[run]
source = z3c.ptcompat

[report]
precision = 2
exclude_lines =
pragma: no cover
if __name__ == '__main__':
raise NotImplementedError
self.fail
raise AssertionError
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ bin
develop-eggs
docs
parts
.coverage
htmlcov/
21 changes: 13 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
language: python
sudo: false
python:
- 2.7
- 3.3
- 3.4
- 3.5
- pypy
- pypy3
- 2.7
- 3.4
- 3.5
- 3.6
- pypy
- pypy3
install:
- pip install tox-travis
- pip install -U pip setuptools
- pip install -U coverage coveralls
- pip install -U -e .[test]
script:
- tox
- coverage run -m zope.testrunner --test-path=src
after_success:
- coveralls
notifications:
email: false
cache: pip
File renamed without changes.
29 changes: 29 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Overview
========

.. image:: https://img.shields.io/pypi/v/z3c.ptcompat.svg
:target: https://pypi.python.org/pypi/z3c.ptcompat/
:alt: Latest release

.. image:: https://img.shields.io/pypi/pyversions/z3c.ptcompat.svg
:target: https://pypi.org/project/z3c.ptcompat/
:alt: Supported Python versions

.. image:: https://travis-ci.org/zopefoundation/z3c.ptcompat.svg?branch=master
:target: https://travis-ci.org/zopefoundation/z3c.ptcompat

.. image:: https://coveralls.io/repos/github/zopefoundation/z3c.ptcompat/badge.svg?branch=master
:target: https://coveralls.io/github/zopefoundation/z3c.ptcompat?branch=master

This package provides a page template engine implementation based on
Chameleon. It plugs into the `zope.pagetemplate
<http://pypi.python.org/pypi/zope.pagetemplate>`_ package and has an
explicit dependency on this package.

You can use the package to replace Zope's reference template engine
with Chameleon in an application based on the Zope Toolkit.

Configuration
-------------

The package is configured via ZCML.
16 changes: 0 additions & 16 deletions README.txt

This file was deleted.

2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
universal = 1
27 changes: 14 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,20 @@
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()

TESTS_REQUIRE = [
'zope.configuration',
'zope.testing',
'zope.testrunner',
]

setup(
name='z3c.ptcompat',
version='2.1.dev0',
version='2.1.0.dev0',
description='Zope-compatible page template engine based on Chameleon.',
long_description='\n\n'.join((
'.. contents::',
read('README.txt'),
read('CHANGES.txt'),
read('README.rst'),
read('CHANGES.rst'),
)),
classifiers=[
'Development Status :: 5 - Production/Stable',
Expand All @@ -38,9 +43,9 @@ 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 :: Implementation',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
Expand All @@ -52,7 +57,7 @@ def read(*rnames):
'Framework :: Zope3',
],
keywords='zpt template zope',
url='http://pypi.python.org/pypi/z3c.ptcompat',
url='https://github.com/zopefoundation/z3c.ptcompat',
author='Zope Corporation and Contributors',
author_email='zope-dev@zope.org',
license='ZPL',
Expand All @@ -67,13 +72,9 @@ def read(*rnames):
'zope.pagetemplate >= 3.6.2',
'zope.traversing',
],
extras_require=dict(
test=[
'zope.testing',
'zope.configuration'],
),
tests_require=[
'zope.testing',
'zope.configuration'],
extras_require={
'test': TESTS_REQUIRE,
},
tests_require=TESTS_REQUIRE,
test_suite='z3c.ptcompat.tests.test_suite',
)
7 changes: 1 addition & 6 deletions src/z3c/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
__import__('pkg_resources').declare_namespace(__name__) # pragma: no cover
2 changes: 1 addition & 1 deletion src/z3c/ptcompat/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self, template):
self.template = template

def __call__(self, context, macros, tal=True, **options):
if tal is False:
if not tal:
return self.template.body

context.vars['repeat'] = TraversableRepeatDict(context.repeat_vars)
Expand Down
17 changes: 11 additions & 6 deletions src/z3c/ptcompat/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
from zope.pagetemplate.tests import test_htmltests as reference


def test_suite():
return unittest.makeSuite(HTMLTests)


class HTMLTests(reference.HTMLTests):
def setUp(self):
import z3c.ptcompat
Expand All @@ -18,6 +14,15 @@ def setUp(self):

super(HTMLTests, self).setUp()

class TestProgram(unittest.TestCase):

def _makeOne(self, *args):
from z3c.ptcompat.engine import Program
return Program.cook(*args)

def test_call_with_no_tal_returns_template_body(self):
body = "<html />"
program, _ = self._makeOne(None, body, None, None)

if __name__ == '__main__':
unittest.TextTestRunner().run(test_suite())
result = program(None, None, tal=False)
self.assertEqual(result, body)
15 changes: 13 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
[tox]
envlist =
py27,py33,py34,py35,pypy,pypy3
py27,py34,py35,py36,pypy,pypy3,coverage

[testenv]
commands =
python setup.py test -q
zope-testrunner --test-path=src []
deps =
.[test]

[testenv:coverage]
usedevelop = true
basepython =
python2.7
commands =
coverage run -m zope.testrunner --test-path=src []
coverage report --fail-under=100
deps =
{[testenv]deps}
coverage

0 comments on commit b3a8ee2

Please sign in to comment.