I am using Python 3.7.4, pytest 6.2.5, tox 3.24.4. Is it an expected behavior that pytest failure will cause tox command (wrap around the pytest) exited with code 1? Appreciate your insights.
Command as follows indicated in Jenkins console log:
foobar run-test: commands[0] | pytest test_foobar.py
Error below:
InvocationError for command /path/.tox/foobar/bin/pytest test_foobar.py (exited with code 1)
Here is the tox.ini file.
[tox]
envlist = foobar,xxx
skipsdist = true
[testenv]
basepython = python3.7
passenv = *
[testenv:foobar]
deps =
-r requirements.txt
commands =
pytest {posargs}
[testenv:xxx]
envdir = {toxworkdir}/foobar
deps =
{[testenv:foobar]deps}
commands =
<something> {posargs}
As an addition to phd
s correct answer, that tox
returns non-zero when one of the commands failed...
If you really need a successful tox
run although a command fails, you can prepend it with a dash.
e.g.
[testenv:foobar]
deps =
-r requirements.txt
commands =
- pytest {posargs}