How to run py.test and linters in `python setup.py test` -
i have project setup.py
file. use pytest
testing framework , run various linters on code (pep8
, pylint
, pydocstyle
, pyflakes
, etc). use tox
run these in several python versions, build documentation using sphinx
.
i run test suites linters on source code python setup.py test
task. if acheive this, use python setup.py test
command running tests in tox.ini
file.
so questions are:
- is reasonable / practice these actions
python setup.py test
? or should use other tool that, writing command directly intox
? - how
setup.py
these actions intest
task?
i know py.test
has integration instructions setup.py test
(here: http://pytest.org/latest/goodpractices.html#integrating-with-setuptools-python-setup-py-test-pytest-runner), i'm looking more "arbitrary cli commands" route, since want run several tools.
1. prefer tox these tasks, because
- it check if deps install (on py-versions)
- it can test code multiple python-versions (virtualenv)
and setup (since you're using tox) don't see benefits of writing python setup.py test
instead of exact test-commands tox.ini
, because add more complexitiy (new users/contributors have search 2 files (tox.ini
, setup.py
) tests/tools running instead of 1 (tox.ini
).
2.
to use command, project’s tests must wrapped in unittest test suite either function, testcase class or method, or module or package containing testcase classes.
Comments
Post a Comment