fix issue160 a failing setup of an xfail-marked tests should

be reported as xfail (not xpass)
This commit is contained in:
holger krekel 2012-06-19 23:48:39 +02:00
parent 672919a8e2
commit 1bbe1d086c
4 changed files with 20 additions and 1 deletions

View File

@ -1,6 +1,8 @@
Changes between 2.2.4 and 2.2.5.dev
-----------------------------------
- fix issue160: a failing setup of an xfail-marked tests should
be reported as xfail (not xpass)
- fix issue128: show captured output when capsys/capfd are used
- pluginmanager.register(...) now raises ValueError if the
plugin has been already registered or the name is taken

View File

@ -110,6 +110,7 @@ class MarkEvaluator:
return expl
@pytest.mark.tryfirst
def pytest_runtest_setup(item):
if not isinstance(item, pytest.Function):
return

View File

@ -556,3 +556,19 @@ def test_default_markers(testdir):
"*xfail(*conditions, reason=None, run=True)*expected failure*",
])
def test_xfail_test_setup_exception(testdir):
testdir.makeconftest("""
def pytest_runtest_setup():
0 / 0
""")
p = testdir.makepyfile("""
import pytest
@pytest.mark.xfail
def test_func():
assert 0
""")
result = testdir.runpytest(p)
assert result.ret == 0
assert 'xfailed' in result.stdout.str()
assert 'xpassed' not in result.stdout.str()

View File

@ -77,4 +77,4 @@ rsyncdirs=tox.ini pytest.py _pytest testing
python_files=test_*.py *_test.py
python_classes=Test Acceptance
python_functions=test
pep8ignore = E401
pep8ignore = E401 E225 E261 E128 E124