Pytest: clarify documentation about skipping of doctests

Created on 29 Jun 2020  路  3Comments  路  Source: pytest-dev/pytest

Quoting https://docs.pytest.org/en/stable/doctest.html the last paragraph:

Skipping tests dynamically

New in version 4.4.

You can use pytest.skip to dynamically skip doctests. For example:

>>> import sys, pytest
>>> if sys.platform.startswith('win'):
...     pytest.skip('this doctest does not work on Windows')

It is not clear where to put this skip-line into. The module? The specific docstring? Does it apply to every doctest definition in the file?

It could be mentioned that # doctest: +SKIP skips a single line/doctest, which is what most people search for(?). A sentence if xfailis possible would also be great.

doctests docs

Most helpful comment

@spaceone thanks for the suggestions.

@prakhargurunani sure thing, no need to ask. Thanks!

All 3 comments

@asottile Can I add this in docs explaining with an example ?

@spaceone thanks for the suggestions.

@prakhargurunani sure thing, no need to ask. Thanks!

@nicoddemus Please see #8080

Was this page helpful?
0 / 5 - 0 ratings