Pytest Installation: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 16: Line 16:
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
pip install -U pytest
pip install -U pytest
</syntaxhighlight>
Given the <code>direnv</code> setup, <code>pytest</code> will automatically become available:
<syntaxhighlight lang='bash'>
which pytest
.../src/main/python/venv/bin/pytest
</syntaxhighlight>
</syntaxhighlight>

Revision as of 01:27, 9 June 2022

Internal

Overview

pytest is installed in a virtual environment and then used from that virtual environment.

For your project, configure direnv to set PATH to give priority to your virtual environment bin directory. In .envrc:

PATH_add "./src/main/python/venv/bin"

Then install pytest with that pip:

pip install -U pytest

Given the direnv setup, pytest will automatically become available:

which pytest

.../src/main/python/venv/bin/pytest