Add example for -ra usage to the docs
This commit is contained in:
parent
d0e9b4812f
commit
01151ff566
|
@ -152,6 +152,42 @@ making it easy in large test suites to get a clear picture of all failures, skip
|
||||||
|
|
||||||
Example:
|
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
|
.. code-block:: pytest
|
||||||
|
|
||||||
$ pytest -ra
|
$ pytest -ra
|
||||||
|
|
Loading…
Reference in New Issue