October 24, 2023

Pytest is really great: even simple assert statements get processed, no need to write complex fixtures or test suite. This means you can write your scripts as usual and just import pytest. To avoid contaminating your current directory with __pycache__ and .pytest_cache directories, set the exported variable PYTHONDONTWRITEBYTECODE=1 and call pytest with -p no:cacheprovider. You can set a simple compiler and errorformat for (Neo)vim by following this blog post. Personally, I use makeprg=pytest\ --tb=short\ -vv\ --no-header\ -p\ no:cacheprovider\ $* instead. #python #vim