Pytest: show extra test summmary info with -r
-
-r
-
-ra
-
(f)ailed
-
(E)error
-
(s)skipped
-
(x)failed
-
(X)passed
-
(p)passed
-
(P)passed with output
-
(a)all except pP
pytest -rx - xfail, expected to fail
pytest -rs - skipped
pytest -ra - all the special cases
import pytest
def test_pass():
assert True
def test_fail():
assert False
@pytest.mark.skip(reason="Unconditional skip")
def test_with_skip():
assert True
@pytest.mark.skipif(True, reason="Conditional skip")
def test_with_skipif():
assert True
@pytest.mark.skipif(False, reason="Conditional skip")
def test_with_skipif_but_run():
assert True
@pytest.mark.xfail(reason = "Expect to fail and failed")
def test_with_xfail_and_fail():
assert False
@pytest.mark.xfail(reason = "Expect to fail but passed")
def test_with_xfail_but_pass():
assert True
pytest -h