[Pytest-commit] Issue #630: XFail on function level ignored if xfail condition on class-level not met (hpk42/pytest)

Matthias Hafner issues-reply at bitbucket.org
Mon Nov 10 19:17:48 CET 2014


New issue 630: XFail on function level ignored if xfail condition on class-level not met
https://bitbucket.org/hpk42/pytest/issue/630/xfail-on-function-level-ignored-if-xfail

Matthias Hafner:


```
#!python
import pytest

@pytest.mark.xfail('False')
class TestBla:
    @pytest.mark.xfail(reason='bug')
    def test_bla(self):
        assert False
```

As the condition for the first xfail is False, the second xfail is wrongly ignored and the printout looks like:


```
#!

❯❯❯ py.test test_bla.py
================================================================ test session starts =================================================================
platform linux2 -- Python 2.7.8 -- py-1.4.26 -- pytest-2.6.4
collected 1 items 

test_bla.py F

====================================================================== FAILURES ======================================================================
__________________________________________________________________ TestBla.test_bla __________________________________________________________________

self = <test_bla.TestBla instance at 0x7f6d80b4d3f8>

    @pytest.mark.xfail(reason='bug')
    def test_bla(self):
>       assert False
E       assert False

test_bla.py:7: AssertionError
============================================================== short test summary info ===============================================================
FAIL test_bla.py::TestBla::()::test_bla
============================================================== 1 failed in 0.01 seconds ==============================================================
```





More information about the pytest-commit mailing list