Skip to content

Commit

Permalink
Merge pull request #2815 from xuanluong/issue-1997-document-xpass
Browse files Browse the repository at this point in the history
Add mention of xpass in skip/xfail documentation
  • Loading branch information
RonnyPfannschmidt committed Oct 6, 2017
2 parents 9ee0a1f + 4bc6ecb commit 761d552
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog/1997.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Explicitly mention ``xpass`` in the documentation of ``xfail``.
12 changes: 8 additions & 4 deletions doc/en/skipping.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@ resource which is not available at the moment (for example a database).

A **xfail** means that you expect a test to fail for some reason.
A common example is a test for a feature not yet implemented, or a bug not yet fixed.
When a test passes despite being expected to fail (marked with ``pytest.mark.xfail``),
it's an **xpass** and will be reported in the test summary.

``pytest`` counts and lists *skip* and *xfail* tests separately. Detailed
information about skipped/xfailed tests is not shown by default to avoid
cluttering the output. You can use the ``-r`` option to see details
corresponding to the "short" letters shown in the test progress::

pytest -rxs # show extra info on skips and xfails
pytest -rxXs # show extra info on xfailed, xpassed, and skipped tests

More details on the ``-r`` option can be found by running ``pytest -h``.

(See :ref:`how to change command line options defaults`)

Expand Down Expand Up @@ -311,12 +315,12 @@ Running it with the report-on-xfail option gives this output::
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
rootdir: $REGENDOC_TMPDIR/example, inifile:
collected 7 items

xfail_demo.py xxxxxxx
======= short test summary info ========
XFAIL xfail_demo.py::test_hello
XFAIL xfail_demo.py::test_hello2
reason: [NOTRUN]
reason: [NOTRUN]
XFAIL xfail_demo.py::test_hello3
condition: hasattr(os, 'sep')
XFAIL xfail_demo.py::test_hello4
Expand All @@ -326,7 +330,7 @@ Running it with the report-on-xfail option gives this output::
XFAIL xfail_demo.py::test_hello6
reason: reason
XFAIL xfail_demo.py::test_hello7

======= 7 xfailed in 0.12 seconds ========

.. _`skip/xfail with parametrize`:
Expand Down

0 comments on commit 761d552

Please sign in to comment.