Skip to content

Commit 01151ff

Browse files
committed
Add example for -ra usage to the docs
1 parent d0e9b48 commit 01151ff

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

doc/en/usage.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,42 @@ making it easy in large test suites to get a clear picture of all failures, skip
152152

153153
Example:
154154

155+
.. code-block:: python
156+
157+
# content of test_example.py
158+
import pytest
159+
160+
161+
@pytest.fixture
162+
def error_fixture():
163+
assert 0
164+
165+
166+
def test_ok():
167+
print("ok")
168+
169+
170+
def test_fail():
171+
assert 0
172+
173+
174+
def test_error(error_fixture):
175+
pass
176+
177+
178+
def test_skip():
179+
pytest.skip("skipping this test")
180+
181+
182+
def test_xfail():
183+
pytest.xfail("xfailing this test")
184+
185+
186+
@pytest.mark.xfail(reason="always xfail")
187+
def test_xpass():
188+
pass
189+
190+
155191
.. code-block:: pytest
156192
157193
$ pytest -ra

0 commit comments

Comments
 (0)