Skip to content

Commit

Permalink
Merge 8c499bf into 37a7227
Browse files Browse the repository at this point in the history
  • Loading branch information
sallner committed Dec 3, 2018
2 parents 37a7227 + 8c499bf commit 2a42cde
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 26 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
@@ -1,12 +1,13 @@
language: python
sudo: false
dist: xenial
python:
- 2.7
- 3.4
- 3.5
- 3.6
- pypy
- pypy3
- 3.7
- pypy2.7-5.10.0
- pypy3.5
install:
- pip install -U pip setuptools
- pip install -U coverage coveralls
Expand Down
5 changes: 3 additions & 2 deletions CHANGES.rst
Expand Up @@ -2,10 +2,11 @@
CHANGES
=========

3.0.1 (unreleased)
3.1.0 (unreleased)
==================

- Nothing changed yet.
- Adapt tests to `zope.configuration >= 4.2`.
- Add support for Python 3.7.


3.0.0 (2017-10-18)
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Expand Up @@ -36,7 +36,7 @@ def read(*rnames):

setup(
name='z3c.template',
version='3.0.1.dev0',
version='3.1.0.dev0',
author="Roger Ineichen and the Zope Community",
author_email="zope-dev@zope.org",
description="A package implementing advanced Page Template patterns.",
Expand All @@ -62,6 +62,7 @@ def read(*rnames):
'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',
'Programming Language :: Python',
Expand All @@ -82,7 +83,7 @@ def read(*rnames):
'setuptools',
'zope.browserpage',
'zope.component',
'zope.configuration',
'zope.configuration >= 4.2.0',
'zope.interface',
'zope.pagetemplate',
'zope.publisher',
Expand Down
24 changes: 9 additions & 15 deletions src/z3c/template/tests.py
Expand Up @@ -15,23 +15,15 @@
"""
import doctest
import itertools
import re
import unittest

from zope.configuration import xmlconfig
from zope.component import testing
from zope.testing import renormalizing

import z3c.pt
import z3c.ptcompat
import z3c.template.template

checker = renormalizing.RENormalizing([
# Python 3 adds module name to exceptions;
# The output of this one is too complex for IGNORE_EXCEPTION_MODULE_IN_PYTHON2
(re.compile('zope.configuration.xmlconfig.ZopeXMLConfigurationError'),
'ZopeXMLConfigurationError'),
])


def setUp(test):
Expand Down Expand Up @@ -83,10 +75,15 @@ def __init__(self):
macro.wrapper = lambda **kwargs: None

macro()
self.assertEqual('text/html', request.response.getHeader("Content-Type"))
self.assertEqual(
'text/html', request.response.getHeader("Content-Type"))


class TestBoundViewTemplate(unittest.TestCase):

assertRaisesRegex = getattr(unittest.TestCase, 'assertRaisesRegex',
unittest.TestCase.assertRaisesRegexp)

def test_call_no__self__uses_first_arg(self):
def im_func(*args):
return args
Expand All @@ -99,8 +96,7 @@ def im_func(*args):

def test_cant_setattr(self):
bound = z3c.template.template.BoundViewTemplate(None, None)
with self.assertRaisesRegexp(AttributeError,
"Can't set attribute"):
with self.assertRaisesRegex(AttributeError, "Can't set attribute"):
setattr(bound, 'im_func', 42)

def test_repr(self):
Expand All @@ -125,16 +121,14 @@ def test_suite():
setUp=setUp, tearDown=tearDown,
optionflags=(doctest.NORMALIZE_WHITESPACE
| doctest.ELLIPSIS
| renormalizing.IGNORE_EXCEPTION_MODULE_IN_PYTHON2),
checker=checker,
| doctest.IGNORE_EXCEPTION_DETAIL),
),
doctest.DocFileSuite(
'zcml.rst',
setUp=setUp, tearDown=tearDown,
optionflags=(doctest.NORMALIZE_WHITESPACE
| doctest.ELLIPSIS
| renormalizing.IGNORE_EXCEPTION_MODULE_IN_PYTHON2),
checker=checker,
| doctest.IGNORE_EXCEPTION_DETAIL),
),
) for setUp in setups)
doctests = list(itertools.chain(*doctests))
Expand Down
4 changes: 2 additions & 2 deletions src/z3c/template/zcml.rst
Expand Up @@ -93,8 +93,8 @@ get an error:
... """, context=context)
Traceback (most recent call last):
...
ZopeXMLConfigurationError: File "<string>", line 4.2-7.8
ConfigurationError: ('No such file', '...this_file_does_not_exist')
ConfigurationError: ('No such file', '...this_file_does_not_exist')
File "<string>", line 4.2-7.8

Layout template
===============
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
@@ -1,6 +1,6 @@
[tox]
envlist =
py27,py34,py35,py36,pypy,pypy3,coverage
py27,py34,py35,py36,py37,pypy,pypy3,coverage

[testenv]
commands =
Expand All @@ -11,7 +11,7 @@ deps =
[testenv:coverage]
usedevelop = true
basepython =
python2.7
python3.7
commands =
coverage run -m zope.testrunner --test-path=src []
coverage report --fail-under=100
Expand Down

0 comments on commit 2a42cde

Please sign in to comment.