views:

250

answers:

1

I have all the eggs my project requires pre-downloaded in a directory, and I would like setuptools to only install packages from that directory.

In my setup.cfg I have:

[easy_install]
allow_hosts = None
find_links = ../../setup

I run python setup.py develop and it finds and installs all the packages correctly.

For testing, I have an additional requirement, specified in setup.py.

tests_require=["pinocchio==0.2"],

This egg also resides locally in the ../../setup directory.

I run python setup.py test and it sees the dependency and finds the egg in ../../setup just fine. However, the egg gets installed to my current directory instead of the site-packages directory with the rest of the eggs.

I've tried specifying the install-dir both in setup.cfg and on the command line and neither seemed to work for the tests command.

I could just add the dependency to the install_requires section, but I'd like to keep what is required for installation and tests separate if possible.

How can I keep the dependency in the tests_require section, but have it installed to the site-packages directory?

+1  A: 

Just looking at the source code (setuptools/command/tests.py), it doesn't look like setup.py test is not supposed to install anything by design (it is testing, so why put anything in site-packages?). It uses fetch_build_egg (setuptools/dist.py) to get the eggs, which actually does a local easy_install. I suspect you can't trivially make test do what you want.

Notes/ideas: My experience with setuptools is that it there are bugs in it and undocumented behavior. (One especially nasty trip-up I found was that it wouldn't enter softlinked directories, when distutils would).

I'd recommend either A) not doing this. :), B) manually installing the file by calling easy_install package. or C) looking into the setuptools system and maybe adding your own command. It isn't too difficult to understand, and knowing it will help a lot when you get future setuptools hick-ups.

UsAaR33
Thanks for your response. I'm not going to bother fighting setuptools, and do either A) or B) as you recommended.
amrox