New issue 527: Show reason for skips in verbose mode on the terminal
https://bitbucket.org/hpk42/pytest/issue/527/show-reason-for-skips-in-verbose-mode-on

Daniel Hahler:

I have seen py.test adding extra information to tests being skipped, but could 
not get it to work with a test which pytest_django runs via pytester.runpytest, 
and which is using `pytest.skip('Test skipped since no Django settings is 
present.')`.

It looks like terminal.pytest_runtest_logreport has no support for printing the 
`longrepr` of the report?!

What worked in the end was using `-r s` to have a report about the skip(s).

I would have expected to get the reason for the skipping with `-vv` or `-vvv` 
already.


    venv/src/pytest_django/bin/python 
venv/src/pytest_django/lib/python2.7/site-packages/pytest.py 
--basetemp=/tmp/pytest-123/testdir/test_sqlite_in_memory_used0/runpytest-0 
--tb=short -vv /tmp/pytest-123/testdir/test_sqlite_in_memory_used0 -s
    ========================================================================== 
test session starts 
===========================================================================
    platform linux2 -- Python 2.7.6 -- py-1.4.20 -- pytest-2.5.2 -- 
venv/src/pytest_django/bin/python
    plugins: ipdb, xdist, django
    collected 1 items

    
../../../../../../tmp/pytest-123/testdir/test_sqlite_in_memory_used0/tpkg/test_the_test.py:5:
 test_a > venv/src/pytest_django/pytest_django/lazy_
    django.py(14)skip_if_no_django()
         13         import ipdb; ipdb.set_trace()
    ---> 14         pytest.skip('Test skipped since no Django settings is 
present.')
         15

    ipdb> c
    > 
venv/src/pytest_django/lib/python2.7/site-packages/_pytest/terminal.py(185)pytest_runtest_logreport()
        184         import ipdb; ipdb.set_trace()
    --> 185         if self.verbosity <= 0:
        186             if not hasattr(rep, 'node') and self.showfspath:

    ipdb> l
        180         self._tests_ran = True
        181         if not letter and not word:
        182             # probably passed setup/teardown
        183             return
        184         import ipdb; ipdb.set_trace()
    --> 185         if self.verbosity <= 0:
        186             if not hasattr(rep, 'node') and self.showfspath:
        187                 self.write_fspath_result(rep.fspath, letter)
        188             else:
        189                 self._tw.write(letter)
        190         else:

btw: it might be useful to have an option to display a report for all cases, 
basically a shortcut for `-r fEsxXw`.


_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
https://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to