I started using pytest. I'm too new to me and I still don't understand.
I intend to write according to Adding info to test report header However, nothing was displayed in the test results.
tests.py
def pytest_report_header(config):
return "sample: functional tests"
The reason why the header is not displayed was because I wrote the above code in a file with test code. If you read the docs properly, you have to write it in a file called conftest.py, as it says # content of conftest.py
.
conftest.py
def pytest_report_header(config):
return "sample: functional tests"
# py.test -v tests.py
====================================================== test session starts ======================================================
platform linux -- Python 3.5.1, pytest-3.0.2, py-1.4.31, pluggy-0.3.1 -- /home/app/.pyenv/versions/3.5.1/bin/python3.5
cachedir: .cache
sample: functional tests
rootdir: /home/app, inifile:
plugins: cov-2.3.1
collected 2 items
tests.py::FunctionalTests::test_not_found PASSED
tests.py::FunctionalTests::test_resize_to_half PASSED
=================================================== 2 passed in 9.56 seconds ====================================================
Recommended Posts