Pytest: One Line Status Summaries for Each Test

Created on 28 Jul 2018  路  4Comments  路  Source: pytest-dev/pytest

Hello! I'm wondering if it's possible to just show the "short test summary info". Or something similar to the following

4 failed, 2 passed, 2 warnings in 68.00 seconds

PASSED test_main.py::test_a
PASSED test_main.py::test_b
FAIL test_main.py::test_c
FAIL test_main.py::test_d
FAIL test_main.py::test_e
FAIL test_main.py::test_f

I've tried running it with the -q and -r pf options but I still get the entire traceback output for the failed tests.

Ideally I would like an output format to get the basic summary of all tests at a quick glance.

Thanks!

question

Most helpful comment

I think --tb=no -ra might be what you want:

$ pytest --tb=no -ra
======================== test session starts ========================
platform win32 -- Python 3.6.3, pytest-3.6.4.dev53+g7f27512a.d20180728, py-1.5.3, pluggy-0.6.0
rootdir: c:\pytest, inifile: tox.ini
plugins: xdist-1.22.2, forked-0.2, hypothesis-3.66.5
collected 10 items

foo.py F.F.F.F.F.                                              [100%]
====================== short test summary info ======================
FAIL foo.py::test[0]
FAIL foo.py::test[2]
FAIL foo.py::test[4]
FAIL foo.py::test[6]
FAIL foo.py::test[8]

================ 5 failed, 5 passed in 0.07 seconds =================

All 4 comments

a stopgap to get that more easily could be using pytest -v --tb=no making the test names/status more verbose, but foregoing the output of tracebacks

I think --tb=no -ra might be what you want:

$ pytest --tb=no -ra
======================== test session starts ========================
platform win32 -- Python 3.6.3, pytest-3.6.4.dev53+g7f27512a.d20180728, py-1.5.3, pluggy-0.6.0
rootdir: c:\pytest, inifile: tox.ini
plugins: xdist-1.22.2, forked-0.2, hypothesis-3.66.5
collected 10 items

foo.py F.F.F.F.F.                                              [100%]
====================== short test summary info ======================
FAIL foo.py::test[0]
FAIL foo.py::test[2]
FAIL foo.py::test[4]
FAIL foo.py::test[6]
FAIL foo.py::test[8]

================ 5 failed, 5 passed in 0.07 seconds =================

Both of these actually work very well. Thank you!

closing as it seems to me that the issue is resolved for you,
please correct me if there is more

Was this page helpful?
0 / 5 - 0 ratings