diff options
author | Georg Brandl <georg@python.org> | 2010-01-02 14:59:27 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-01-02 14:59:27 +0100 |
commit | f4da14806c69fd1eb90a30ace625edc01d2ca5fc (patch) | |
tree | b855e2b0dba66cf314b473bc82234a2819f8327d /sphinx/ext/doctest.py | |
parent | c9201f282e431acefc8dc4b9afcd5a6dd6d40b66 (diff) | |
download | sphinx-git-f4da14806c69fd1eb90a30ace625edc01d2ca5fc.tar.gz |
#310: support exception messages in the ``testoutput`` blocks of the ``doctest`` extension.
Also add minimal test cases for the doctest extension.
Diffstat (limited to 'sphinx/ext/doctest.py')
-rw-r--r-- | sphinx/ext/doctest.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sphinx/ext/doctest.py b/sphinx/ext/doctest.py index 9132dd815..a424bdfec 100644 --- a/sphinx/ext/doctest.py +++ b/sphinx/ext/doctest.py @@ -355,7 +355,14 @@ Doctest summary options = code[1] and code[1].options or {} # disable <BLANKLINE> processing as it is not needed options[doctest.DONT_ACCEPT_BLANKLINE] = True + # find out if we're testing an exception + m = parser._EXCEPTION_RE.match(output) + if m: + exc_msg = m.group('msg') + else: + exc_msg = None example = doctest.Example(code[0].code, output, + exc_msg=exc_msg, lineno=code[0].lineno, options=options) test = doctest.DocTest([example], {}, group.name, |