mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Added pyversion option for doctest (issue 3303)
Code, tests and documentation.
This commit is contained in:
@@ -63,7 +63,7 @@ a comma-separated list of group names.
|
||||
default set of flags is specified by the :confval:`doctest_default_flags`
|
||||
configuration variable.
|
||||
|
||||
This directive supports two options:
|
||||
This directive supports three options:
|
||||
|
||||
* ``hide``, a flag option, hides the doctest block in other builders. By
|
||||
default it is shown as a highlighted doctest block.
|
||||
@@ -73,6 +73,17 @@ a comma-separated list of group names.
|
||||
explicit flags per example, with doctest comments, but they will show up in
|
||||
other builders too.)
|
||||
|
||||
* ``pyversion``, a string option, can be used to specify the required Python
|
||||
version for the example to be tested. For instance, in the following case
|
||||
the example will be tested only for Python versions greather than 3.3::
|
||||
|
||||
.. doctest::
|
||||
:pyversion: > 3.3
|
||||
|
||||
The supported operands are ``<``, ``<=``, ``==``, ``>=``, and ``>``.
|
||||
|
||||
.. versionadded:: 1.5
|
||||
|
||||
Note that like with standard doctests, you have to use ``<BLANKLINE>`` to
|
||||
signal a blank line in the expected output. The ``<BLANKLINE>`` is removed
|
||||
when building presentation output (HTML, LaTeX etc.).
|
||||
|
||||
Reference in New Issue
Block a user