February 2022
Intermediate to advanced
274 pages
6h 28m
English
To debug the next test failure, we’re going to combine tox and pdb. For this to work, we have to make sure we can pass arguments through tox to pytest. This is done with tox’s {posargs} feature, which was discussed in Passing pytest Parameters Through tox.
We’ve already got that set up in our tox.ini for Cards:
| | [tox] |
| | envlist = py39, py310 |
| | isolated_build = True |
| | skip_missing_interpreters = True |
| | |
| | [testenv] |
| | deps = |
| | pytest |
| | faker |
| | pytest-cov |
| » | commands = pytest --cov=cards --cov=tests --cov-fail-under=100 {posargs} |
We’d like to run the Python 3.10 environment, and start the debugger at the test failure. We could run it once with -e py310, then use -e py310 -- --lf --trace ...
Read now
Unlock full access