Skip to content

Commit

Permalink
Fix tests for zope.configuration > 4.2
Browse files Browse the repository at this point in the history
The way exceptions are wrapped has changed. Now we can also get rid of renormalizing infrastructure.
  • Loading branch information
sallner committed Nov 30, 2018
1 parent 37a7227 commit ce75d87
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
3.0.1 (unreleased)
==================

- Nothing changed yet.
- Adapt tests to `zope.configuration >= 4.2`.


3.0.0 (2017-10-18)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def read(*rnames):
'setuptools',
'zope.browserpage',
'zope.component',
'zope.configuration',
'zope.configuration >= 4.2.0',
'zope.interface',
'zope.pagetemplate',
'zope.publisher',
Expand Down
14 changes: 2 additions & 12 deletions src/z3c/template/tests.py
Original file line number Diff line number Diff line change
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 @@ -125,16 +117,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
Original file line number Diff line number Diff line change
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

0 comments on commit ce75d87

Please sign in to comment.