[pytest-dev] showing reason for skipped and verbose

James bjlockie at lockie.ca
Fri Nov 4 09:02:30 EDT 2016


$ py.test -v testscript.py
============================= test session starts 
==============================
platform linux2 -- Python 2.7.12, pytest-2.8.7, py-1.4.31, pluggy-0.3.1 
-- /usr/bin/python
cachedir: .cache
rootdir: /home/rjl/pytest, inifile:
collected 8 items

testscript.py::TestAclass::test_1 PASSED
testscript.py::TestAclass::test_2 PASSED
testscript.py::TestAclass::test_3 PASSED
testscript.py::TestAclass::test_4 PASSED
testscript.py::TestBclass::test_21 SKIPPED
testscript.py::TestBclass::test_22 SKIPPED
testscript.py::TestBclass::test_23 SKIPPED
testscript.py::TestBclass::test_24 SKIPPED

===================== 4 passed, 4 skipped in 0.03 seconds 
======================

$ py.test -rv testscript.py
============================= test session starts 
==============================
platform linux2 -- Python 2.7.12, pytest-2.8.7, py-1.4.31, pluggy-0.3.1
rootdir: /home/rjl/pytest, inifile:
collected 8 items

testscript.py ....ssss

===================== 4 passed, 4 skipped in 0.01 seconds 
======================

$ py.test -rs testscript.py
============================= test session starts 
==============================
platform linux2 -- Python 2.7.12, pytest-2.8.7, py-1.4.31, pluggy-0.3.1
rootdir: /home/rjl/pytest, inifile:
collected 8 items

testscript.py ....ssss
=========================== short test summary info 
============================
SKIP [4] /home/rjl/pytest/conftest.py:8: test needs -A option to run

===================== 4 passed, 4 skipped in 0.01 seconds 
======================


I want the output from the first one showing 'PASSED' or 'SKIPPED' but I 
also want to see the reason a specific test was skipped.
Something like:
testscript.py::TestAclass::test_1 PASSED
testscript.py::TestAclass::test_2 PASSED
testscript.py::TestAclass::test_3 PASSED
testscript.py::TestAclass::test_4 PASSED
testscript.py::TestBclass::test_21 SKIPPED (needs -A option to run)
testscript.py::TestBclass::test_22 SKIPPED (needs -A option to run)
testscript.py::TestBclass::test_23 SKIPPED (needs -A option to run)
testscript.py::TestBclass::test_24 SKIPPED (needs -A option to run)



More information about the pytest-dev mailing list