The doctests succeeds when running on python 2.x, fails when running on python 3.x (or vice versa) and complains when checking an exception. Something similar to this:
>>> Sequence('invalid')
Differences (unified diff with -expected +actual):
@@ -1,3 +1,10 @@
Traceback (most recent call last):
- ...
-SequenceNotFound
+ File "/opt/python/3.5.6/lib/python3.5/doctest.py", line 1321, in __run
+ compileflags, 1), test.globs)
+ File "<doctest invenio_sequencegenerator[30]>", line 1, in <module>
+ Sequence('invalid')
+ File "/home/travis/build/inveniosoftware/invenio-sequencegenerator/invenio_sequencegenerator/api.py", line 61, in __init__
+ template = Template(template)
+ File "/home/travis/build/inveniosoftware/invenio-sequencegenerator/invenio_sequencegenerator/api.py", line 31, in __init__
+ raise SequenceNotFound()
+invenio_sequencegenerator.errors.SequenceNotFound
/home/travis/build/inveniosoftware/invenio-sequencegenerator/invenio_sequencegenerator/__init__.py:150: DocTestFailure
Problem
The doctests succeeds when running on python 2.x, fails when running on python 3.x (or vice versa) and complains when checking an exception. Something similar to this:
Solution
Add
doctest.IGNORE_EXCEPTION_DETAIL
to the doctest. Something similar to this:Caveats
This will stop checking the exception message, which is part of the test it self, but the exception type is still checked.