[pytest-dev] pytest-sugar: tests skipped with pytest.mark.skipif not shown as such

Thomas De Schampheleire patrickdepinguin at gmail.com
Sat Feb 6 04:09:50 EST 2016


Hi,

(I asked this question on IRC but had to leave before I got an answer)

I have been recommended to use pytest-sugar and so far have liked it a lot.
However, I now noticed a problem in reporting of skipped tests.

If I use pytest.mark.skipif for a test, the test is not shown as
'skipped' with pytest-sugar, while regular pytest does.
If I use nose.plugins.skip.SkipTest from a test instead, pytest-sugar
_does_ see it as skipped.

Am I incorrect in expecting to see tests that are skipped with skipif
to be marked as 'skipped' in pytest-sugar?

Example code is the following:

import pytest
import nose

def test_foo():
    assert True

@pytest.mark.skipif(True, reason='testing skipping')
def test_skipped():
    assert False

def test_nose_skipped():
    raise nose.plugins.skip.SkipTest('nose skipping')
    assert False



I tried to add some debug statements in pytest_sugar.py, and noticed
that for the skipif test there is a 'setup' trigger where
report.status says 'skipped' but it becomes 'passed' in the 'teardown'
trigger. There is no 'call' trigger for that skipped test.
I have not been able to determine any useful things further.

Please let me know if this is expected behavior, and what I should do
to display skipped tests.

Thanks,
Thomas


More information about the pytest-dev mailing list