Add documentation for doctest flags and remove dead code
This commit is contained in:
parent
f66e0825b2
commit
61caa4f776
|
@ -1,6 +1,8 @@
|
||||||
Unreleased
|
Unreleased
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
- add a doctest option for doctest flags
|
||||||
|
|
||||||
- Improve assertion failure reporting on iterables, by using ndiff and pprint.
|
- Improve assertion failure reporting on iterables, by using ndiff and pprint.
|
||||||
|
|
||||||
- removed outdated japanese docs from source tree.
|
- removed outdated japanese docs from source tree.
|
||||||
|
|
|
@ -102,9 +102,6 @@ def get_optionflags(parent):
|
||||||
import doctest
|
import doctest
|
||||||
optionflags_str = parent.config.getini("doctest_optionflags")
|
optionflags_str = parent.config.getini("doctest_optionflags")
|
||||||
flag_lookup_table = _get_flag_lookup()
|
flag_lookup_table = _get_flag_lookup()
|
||||||
if not optionflags_str:
|
|
||||||
return doctest.ELLIPSIS
|
|
||||||
|
|
||||||
flag_acc = 0
|
flag_acc = 0
|
||||||
for flag in optionflags_str:
|
for flag in optionflags_str:
|
||||||
flag_acc |= flag_lookup_table[flag]
|
flag_acc |= flag_lookup_table[flag]
|
||||||
|
|
|
@ -126,3 +126,8 @@ Builtin configuration file options
|
||||||
derived class.
|
derived class.
|
||||||
|
|
||||||
See :ref:`change naming conventions` for examples.
|
See :ref:`change naming conventions` for examples.
|
||||||
|
|
||||||
|
.. confval:: doctest_optionflags
|
||||||
|
|
||||||
|
One or more doctest flag names from the standard ``doctest`` module.
|
||||||
|
`See how py.test handles doctests <doctest.html>`_.
|
||||||
|
|
|
@ -60,3 +60,12 @@ It is possible to use fixtures using the ``getfixture`` helper::
|
||||||
|
|
||||||
Also, :ref:`usefixtures` and :ref:`autouse` fixtures are supported
|
Also, :ref:`usefixtures` and :ref:`autouse` fixtures are supported
|
||||||
when executing text doctest files.
|
when executing text doctest files.
|
||||||
|
|
||||||
|
The standard ``doctest`` module provides some setting flags to configure the
|
||||||
|
strictness of doctest tests. In py.test You can enable those flags those flags
|
||||||
|
using the configuration file. To make pytest ignore trailing whitespaces and
|
||||||
|
ignore lengthy exception stack traces you can just write::
|
||||||
|
|
||||||
|
# content of pytest.ini
|
||||||
|
[pytest]
|
||||||
|
doctest_optionflags= NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL
|
||||||
|
|
Loading…
Reference in New Issue