test_ok2/doc/en/example/xfail_demo.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
448 B
Python
Raw Normal View History

import pytest
2018-05-23 22:48:46 +08:00
xfail = pytest.mark.xfail
2018-05-23 22:48:46 +08:00
@xfail
def test_hello():
assert 0
2018-05-23 22:48:46 +08:00
@xfail(run=False)
def test_hello2():
assert 0
2018-05-23 22:48:46 +08:00
@xfail("hasattr(os, 'sep')")
def test_hello3():
assert 0
2018-05-23 22:48:46 +08:00
@xfail(reason="bug 110")
def test_hello4():
assert 0
2018-05-23 22:48:46 +08:00
@xfail('pytest.__version__[0] != "17"')
def test_hello5():
assert 0
2018-05-23 22:48:46 +08:00
def test_hello6():
pytest.xfail("reason")
2018-05-23 22:48:46 +08:00
@xfail(raises=IndexError)
def test_hello7():
x = []
x[1] = 1