From 01151ff566388a53b5cac3eeb90aae6045275c75 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 5 Jan 2019 16:53:12 -0200 Subject: [PATCH] Add example for -ra usage to the docs --- doc/en/usage.rst | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/doc/en/usage.rst b/doc/en/usage.rst index 87171507d..2a2d972c0 100644 --- a/doc/en/usage.rst +++ b/doc/en/usage.rst @@ -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