mirror of
https://github.com/python/cpython.git
synced 2025-10-28 09:10:36 +00:00
#11390: convert doctest CLI to argparse and add -o and -f options.
This provides a way to specify arbitrary doctest options when using the CLI interface to process test files, just as one can when calling testmod or testfile programmatically.
This commit is contained in:
parent
c00fffb659
commit
5707d508e1
5 changed files with 273 additions and 12 deletions
|
|
@ -495,7 +495,10 @@ Option Flags
|
|||
A number of option flags control various aspects of doctest's behavior.
|
||||
Symbolic names for the flags are supplied as module constants, which can be
|
||||
or'ed together and passed to various functions. The names can also be used in
|
||||
:ref:`doctest directives <doctest-directives>`.
|
||||
:ref:`doctest directives <doctest-directives>`, and may be passed to the
|
||||
doctest command line interface via the ``-o`` option.
|
||||
|
||||
.. versionadded:: 3.4 the ``-o`` command line option
|
||||
|
||||
The first group of options define test semantics, controlling aspects of how
|
||||
doctest decides whether actual output matches an example's expected output:
|
||||
|
|
@ -640,6 +643,9 @@ The second group of options controls how test failures are reported:
|
|||
1. This flag may be useful during debugging, since examples after the first
|
||||
failure won't even produce debugging output.
|
||||
|
||||
The doctest command line accepts the option ``-f`` as a shorthand for ``-o
|
||||
FAIL_FAST``.
|
||||
|
||||
.. versionadded:: 3.4
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -173,8 +173,15 @@ instructions.
|
|||
doctest
|
||||
-------
|
||||
|
||||
Added ``FAIL_FAST`` flag to halt test running as soon as the first failure is
|
||||
detected. (Contributed by R. David Murray and Daniel Urban in :issue:`16522`.)
|
||||
Added :data:`~doctest.FAIL_FAST` flag to halt test running as soon as the first
|
||||
failure is detected. (Contributed by R. David Murray and Daniel Urban in
|
||||
:issue:`16522`.)
|
||||
|
||||
Updated the doctest command line interface to use :mod:`argparse`, and added
|
||||
``-o`` and ``-f`` options to the interface. ``-o`` allows doctest options to
|
||||
be specified on the command line, and ``-f`` is a shorthand for ``-o
|
||||
FAIL_FAST`` (to parallel the similar option supported by the :mod:`unittest`
|
||||
CLI). (Contributed by R. David Murray in :issue:`11390`.)
|
||||
|
||||
|
||||
functools
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue