Add example for -ra usage to the docs

This commit is contained in:
Bruno Oliveira 2019-01-05 16:53:12 -02:00
parent d0e9b4812f
commit 01151ff566
1 changed files with 36 additions and 0 deletions

View File

@ -152,6 +152,42 @@ making it easy in large test suites to get a clear picture of all failures, skip
Example:
.. code-block:: python
# content of test_example.py
import pytest
@pytest.fixture
def error_fixture():
assert 0
def test_ok():
print("ok")
def test_fail():
assert 0
def test_error(error_fixture):
pass
def test_skip():
pytest.skip("skipping this test")
def test_xfail():
pytest.xfail("xfailing this test")
@pytest.mark.xfail(reason="always xfail")
def test_xpass():
pass
.. code-block:: pytest
$ pytest -ra