How do I force `setup.py test` to install dependencies into my `virtualenv`?
By design, you can't make the tests_requires
or the setup_requires
entries go into the virtual environment. The idea is to separate what is required for performing tests/setup and what is required to actually use the package being installed. For example, I may require that the "coverage" module be needed for running tests on my package, but it isn't used by any of my code in the package. Therefore, if I didn't have "coverage" in my environment when I go and run tests, I wouldn't want "coverage" to get installed into the environment if my package didn't need it.
If you are using setuptools
, you can specify test dependencies using the tests_require
keyword argument for the setup
method.
from setuptools import setupsetup( name='your-package-name', version='1.0.0', author='me', author_email='me@mybasement.com', install_requires=['Pygments>=1.4'], tests_require=['nose'], packages=[ 'your_package_name', ],)
When you run python setup.py test
, this will check for nose
and install it to the currently active virtualenv
using pip
if not already available.
Note that this argument will be ignored if you are using distribute.core.setup
(nor will a test
command be available).