Skip to content

Commit

Permalink
Support Python 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
mgedmin committed Dec 28, 2016
1 parent 64f1e20 commit e5636d1
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 17 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ python:
- 3.3
- 3.4
- 3.5
- 3.6
- pypy
- pypy3.3-5.2-alpha1
matrix:
Expand Down
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ zope.testrunner Changelog
``zope.testrunner[subunit]`` to their ``install_requires`` or else
depend directly on ``python-subunit``.

- Support Python 3.6.


4.5.1 (2016-06-20)
==================

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def run_tests(self):
"Programming Language :: Python :: 3.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',
"Topic :: Software Development :: Libraries :: Python Modules",
Expand Down
39 changes: 23 additions & 16 deletions src/zope/testrunner/tests/test_doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@
(re.compile(r'builtins\.(SyntaxError|TypeError)'),
r'exceptions.\1'),

# Python 3.6 introduces ImportError subclasses
(re.compile(r'ModuleNotFoundError:'), 'ImportError:'),

# Python 3.3 has better exception messages
(re.compile("ImportError: No module named '(?:[^']*[.])?([^'.]*)'"),
r'ImportError: No module named \1'),
Expand Down Expand Up @@ -160,6 +163,9 @@
(re.compile(r'builtins\.(SyntaxError|TypeError)'),
r'exceptions.\1'),

# Python 3.6 introduces ImportError subclasses
(re.compile(r'ModuleNotFoundError:'), 'ImportError:'),

# Python 3.3 has better exception messages
(re.compile("ImportError: No module named '(?:[^']*[.])?([^'.]*)'"),
r'ImportError: No module named \1'),
Expand Down Expand Up @@ -194,6 +200,9 @@ def tearDown(test):


def test_suite():
optionflags = (doctest.ELLIPSIS |
doctest.NORMALIZE_WHITESPACE |
doctest.REPORT_NDIFF)
suites = [
doctest.DocFileSuite(
'testrunner-arguments.txt',
Expand Down Expand Up @@ -225,11 +234,11 @@ def test_suite():
'testrunner-eggsupport.txt',
'testrunner-stops-when-stop-on-error.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE,
optionflags=optionflags,
checker=checker),
doctest.DocTestSuite('zope.testrunner'),
doctest.DocTestSuite('zope.testrunner.coverage',
optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE),
optionflags=optionflags),
doctest.DocTestSuite('zope.testrunner.options'),
doctest.DocTestSuite('zope.testrunner.find'),
]
Expand All @@ -240,7 +249,7 @@ def test_suite():
doctest.DocFileSuite(
'testrunner-gc.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE,
optionflags=optionflags,
checker=checker))

# PyPy does not support sourceless imports, apparently (tried version 1.9)
Expand All @@ -249,15 +258,15 @@ def test_suite():
doctest.DocFileSuite(
'testrunner-wo-source.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE,
optionflags=optionflags,
checker=checker))

if sys.platform == 'win32':
suites.append(
doctest.DocFileSuite(
'testrunner-coverage-win32.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE,
optionflags=optionflags,
checker=checker))

# Python <= 2.4.1 had a bug that prevented hotshot from running in
Expand All @@ -274,7 +283,7 @@ def test_suite():
doctest.DocFileSuite(
'testrunner-profiling.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE,
optionflags=optionflags,
checker = renormalizing.RENormalizing([
(re.compile(r'tests_profile[.]\S*[.]prof'),
'tests_profile.*.prof'),
Expand All @@ -291,7 +300,7 @@ def test_suite():
doctest.DocFileSuite(
'testrunner-profiling-cprofiler.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE,
optionflags=optionflags,
checker = renormalizing.RENormalizing([
(re.compile(r'tests_profile[.]\S*[.]prof'),
'tests_profile.*.prof'),
Expand All @@ -303,7 +312,7 @@ def test_suite():
doctest.DocFileSuite(
'testrunner-report-skipped.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE,
optionflags=optionflags,
checker=checker)
)

Expand All @@ -312,7 +321,7 @@ def test_suite():
doctest.DocFileSuite(
'testrunner-leaks.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE,
optionflags=optionflags,
checker = renormalizing.RENormalizing([
(re.compile(r'(\d+ minutes )?\d+[.]\d\d\d seconds'), 'N.NNN seconds'),
(re.compile(r'sys refcount=\d+ +change=\d+'),
Expand All @@ -332,7 +341,7 @@ def test_suite():
doctest.DocFileSuite(
'testrunner-leaks-err.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE,
optionflags=optionflags,
checker=checker,
)
)
Expand All @@ -344,31 +353,29 @@ def test_suite():
doctest.DocFileSuite(
'testrunner-subunit-err.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.ELLIPSIS + doctest.NORMALIZE_WHITESPACE,
optionflags=optionflags,
checker=checker))
else:
suites.append(
doctest.DocFileSuite(
'testrunner-subunit.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.ELLIPSIS +
doctest.NORMALIZE_WHITESPACE +
doctest.REPORT_NDIFF,
optionflags=optionflags,
checker=checker))
if hasattr(sys, 'gettotalrefcount'):
suites.append(
doctest.DocFileSuite(
'testrunner-subunit-leaks.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.ELLIPSIS + doctest.NORMALIZE_WHITESPACE,
optionflags=optionflags,
checker=checker))

if sys.version_info[:3] >= (2,7,0):
# Python 2.7 adds support for unittest.expectedFailure
suites.append(doctest.DocFileSuite(
'testrunner-unexpected-success.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE,
optionflags=optionflags,
checker=checker))

return unittest.TestSuite(suites)
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py27,pypy,py33,py34,py35,pypy3,py27-subunit,pypy-subunit
py27,pypy,py33,py34,py35,py36,pypy3,py27-subunit,pypy-subunit

[testenv]
deps =
Expand Down

0 comments on commit e5636d1

Please sign in to comment.