placed selectable, and default to ``'default'``.
* sphinx.ext.doctest: Replace <BLANKLINE> in doctest blocks by
- real blank lines for presentation output.
+ real blank lines for presentation output, and remove doctest
* sphinx.environment: Move doctest_blocks out of block_quotes to
support indented doctest blocks.
signal a blank line in the expected output. The ``<BLANKLINE>`` is removed
when building presentation output (HTML, LaTeX etc.).
+ Also, you can give inline doctest options, like in doctest::
+ >>> datetime.date.now() # doctest: +SKIP
+ datetime.date(2008, 1, 1)
+ They will be respected when the test is run, but stripped from presentation
.. directive:: .. testcode:: [group]
Note though that you can't have blank lines in reST doctest blocks. They
- will be interpreted as one block ending and another one starting.
+ will be interpreted as one block ending and another one starting. Also,
+ removal of ``<BLANKLINE>`` and ``# doctest:`` options only works in
from sphinx.util.console import bold
blankline_re = re.compile(r'^\s*<BLANKLINE>', re.MULTILINE)
# set up the necessary directives
# so that our builder recognizes them, and the other builders are happy.
code = '\n'.join(content)
- if name == 'doctest' and '<BLANKLINE>' in code:
- # convert <BLANKLINE>s to ordinary blank lines for presentation
- code = blankline_re.sub('', code)
+ if '<BLANKLINE>' in code:
+ # convert <BLANKLINE>s to ordinary blank lines for presentation
+ code = blankline_re.sub('', code)
+ if doctestopt_re.search(code):
+ code = doctestopt_re.sub('', code)
nodetype = nodes.literal_block
if name == 'testsetup' or 'hide' in options: