I am reading and trying to understand some libraries online, and I come across the following:
I am reading online and I found a tox.ini file like the following:
[tox]
envlist =
py27
py35
py36
py37
flake8
[testenv:flake8]
basepython = python
deps = flake8
commands = flake8 related
[testenv]
setenv =
PYTHONPATH = {toxinidir}:{toxinidir}/related
deps =
-r{toxinidir}/dev-requirements.txt
commands =
pip install -U pip
py.test --basetemp={envtmpdir}
I am still not being able to make it run. I did the following:
pip install -U pip
py.test --basetemp={envtmpdir}
py.tests --basetemp={py37}
usage: py.test [options] [file_or_dir] [file_or_dir] [...]
py.test: error: unrecognized arguments: --mccabe --pep8 --flake8
inifile: /home/tmhdev/Documents/related/pytest.ini
rootdir: /home/tmhdev/Documents/related
How can I run the tests in this file? The library is called related: https://github.com/genomoncology/related/tree/master/tests
tox
itself is an environment manager that can run a series of commands for you (think like make
but it knows about python things)
Usually the easiest way to run tests when there is a tox.ini
is to just invoke tox
itself (which you can install with pip install tox
)
If you want to reproduce ~roughly what tox is doing under the hood (let's say for tox -e py37
above) you'd need to create a virtualenv and then invoke the tests.
# environment setup
virtualenv -p python3.7 .tox/py37
. .tox/py37/bin/activate
.tox/py37/bin/pip install -r dev-requirements.txt
export PYTHONPATH=$PWD:$PWD/related
# testenv `commands`
pip install -U pip
py.test --basetemp=.tox/py37/tmp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With