Continuation of pytest study. I am trying it by referring to the official document and reverse lookup pytest.
Enables pytest to be executed with the following command. The procedure is as described in here.
python setup.py test
Add the settings to the setup.py file. It also includes a coverage plugin.
setup.py
setup_requires = [
'pytest-runner',
]
tests_require = [
'pytest-cov',
'pytest',
]
setup( #Partial excerpt
setup_requires=setup_requires,
tests_require=tests_require,
)
Add the settings to the setup.cfg file. We have set options to display coverage and test time.
setup.cfg
[aliases]
test=pytest
[tool:pytest]
addopts = --verbose --durations=0 --cov=app --cov-report=html
testpaths = tests
python_files = *.py
reference
Recommended Posts