Skip to content

Commit

Permalink
fix doctest on Python 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentfretin committed May 15, 2017
1 parent c7d1ab7 commit 5c39c28
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/keas/kmi/persistent.txt
Expand Up @@ -152,7 +152,7 @@ error:
>>> pwd.password
Traceback (most recent call last):
...
ValueError: need more than 1 value to unpack
ValueError: not enough values to unpack (expected 2, got 1)

But we can apply the conversion step:

Expand Down
10 changes: 9 additions & 1 deletion src/keas/kmi/tests.py
Expand Up @@ -14,12 +14,14 @@
"""Test Setup
"""
import doctest
import re
import tempfile
import transaction
import unittest

from zope.app.testing import setup
from zope.component import provideUtility
from zope.testing.renormalizing import RENormalizing

from keas.kmi.testing import TestingKeyManagementFacility
from keas.kmi.interfaces import IKeyManagementFacility
Expand All @@ -39,6 +41,11 @@ def tearDownPersistent(test):


def test_suite():
checker = RENormalizing([
# fix doctest for ValueError exception on Python < 3.6
(re.compile(r"ValueError: need more than 1 value to unpack"),
"ValueError: not enough values to unpack (expected 2, got 1)")
])
return unittest.TestSuite([
doctest.DocFileSuite(
'README.txt',
Expand All @@ -49,5 +56,6 @@ def test_suite():
doctest.DocFileSuite(
'persistent.txt',
setUp=setUpPersistent, tearDown=tearDownPersistent,
optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
checker=checker),
])

0 comments on commit 5c39c28

Please sign in to comment.