How do I use pytest with virtualenv?
<p>I installed <code>pytest</code> into a virtual environment (using <code>virtualenv</code>) and am running it from that virtual environment, but it is not using the packages that I installed in that virtual environment. Instead, it is using the main system packages. (Using <code>python -m unittest discover</code>, I can actually run my tests with the right python and packages, but I want to use the py.test framework.)</p>

<p>Is it possible that py.test is actually not running the pytest inside the virtual environment and I have to specify which pytest to run?</p>

<p>How to I get py.test to use only the python and packages that are in my virtualenv?</p>

<p>Also, since I have several version of Python on my system, how do I tell which Python that Pytest is using? Will it automatically use the Python within my virtual environment, or do I have to specify somehow?</p>