Skip to content

clarify documentation about skipping of doctests #7429

@spaceone

Description

@spaceone

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: doctestsrelated to the doctests builtin plugintype: docsdocumentation improvement, missing or needing clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions