There are several issues with error reports when doctests are wrapped in DocTestCase.
-
When error happens during compilation or execution an example, the traceback contains several lines from
doctest.py:File ... exec(compile(example.source, filename, "single", ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ compileflags, True), test.globs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -
When the output differs, the traceback of AssertionError contains other line from
doctest.py:Traceback (most recent call last): File ... raise self.failureException(self.format_failure(new.getvalue())) -
Also, the AssertionError message contains redundant newline character.