"setup.py test" Egg location?

I have all the eggs that my project requires prior download in the directory, and I would like setuptools to install only packages from this 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 is also located locally in the ../../setup directory.

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

I tried to specify install-dir both in setup.cfg and on the command line, and none of them worked for the tests command.

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

How to save the dependency in the tests_require section, but install it in the site-packages directory?

+7
python setuptools
source share
1 answer

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

Notes / ideas: My experience with setuptools is that it has bugs and undocumented behavior. (One particularly unpleasant trip I discovered was that it won’t go into soft-link directories when there are distutils).

I would recommend either A) not to do this. :), B) manually installing the file by calling the easy_install package. or C) by looking at setuptools and possibly adding your own command. This is not so difficult to understand, and knowing that it will help a lot when you get future setuptools settings.

+3
source share

All Articles