Как добавить краткое описание в pytest, чтобы оно отображалось в кратком сводном отчете? - PullRequest
0 голосов
/ 01 апреля 2020

Как добавить краткое описание в pytest, чтобы оно отображалось в кратком сводном отчете? например что-то вроде:

@pytest.short.desc("Just making sure we got Fibonacci right.")
def test_fib():
    assert fib(1) == 1
    assert fib(2) == 1
    assert fib(7) == 13
    with pytest.raises(AssertionError):
       fib(-10)

приведет к следующему выводу:

(PyRepo) /somewhere/somepath>pytest -rA
======================================= test session starts =======================================
platform win32 -- Python 3.7.6, pytest-5.4.1, py-1.8.1, pluggy-0.13.1 -- /somewhere/somepath/scripts/python.exe
cachedir: .pytest_cache
rootdir: /somewhere/somepath, inifile: setup.cfg, testpaths: tests
plugins: cov-2.8.1
collected 1 item

tests/test_skeleton.py::test_fib PASSED                                                      [100%]

============================================= PASSES ==============================================

----------- coverage: platform win32, python 3.7.6-final-0 -----------
Name                       Stmts   Miss Branch BrPart  Cover   Missing
----------------------------------------------------------------------
src/myproject/skeleton.py      33     14      2      0    60%   56-81, 90-91, 101-105, 111

===================================== short test summary info =====================================
PASSED tests/test_skeleton.py::test_fib     Just making sure we got Fibonacci right. 
======================================== 1 passed in 0.26s ========================================
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...