New issue 607: pytest.skip will skip entire files when used as a decorator https://bitbucket.org/hpk42/pytest/issue/607/pytestskip-will-skip-entire-files-when
Bryce Lampe: I've seen several people assume that `@pytest.skip` can be used in place of `@pytest.mark.skipif(True, reason="foo")`. It seems like a reasonable convenience and it *seems* to work. However, this is actually quite dangerous because it has the unexpected side-effect of skipping every test in the file: ``` $ cat test.py import pytest @pytest.skip def test_1(): print 1 def test_2(): print 2 def test_3(): print 3 ``` Expected behavior: ``` $ py.test test.py -v ============================= test session starts ============================== platform darwin -- Python 2.7.8 -- py-1.4.25 -- pytest-2.6.3 -- /Users/blampe/env/bin/python2.7 collected 2 items test.py::test_2 PASSED test.py::test_3 PASSED =========================== 2 passed in 0.01 seconds =========================== ``` Actual behavior: ``` $ py.test test.py -v ============================= test session starts ============================== platform darwin -- Python 2.7.8 -- py-1.4.25 -- pytest-2.6.3 collected 0 items / 1 skipped ========================== 1 skipped in 0.00 seconds ========================== ``` Note that this is reporting the wrong number of skipped tests, so this definitely seems unintentional. _______________________________________________ pytest-commit mailing list pytest-commit@python.org https://mail.python.org/mailman/listinfo/pytest-commit