[Distutils] test resources with setup tools

Manlio Perillo manlio_perillo at libero.it
Mon Apr 26 20:52:42 CEST 2010

P.J. Eby ha scritto:
> [...]
>> Right now I'm using a shell script that must be manually executed.
>> The data is copied to a test/resources directory.
>> The test directory contains the test suite and it is in the top level
>> directory of the Python project. It is not installed on the system by
>> the setup.py script.
>> Test functions access the the data using __file__.
>> I was just wondering if there is a better method.
> If you put those resources as package data files or metadata files in
> another PyPI project, so that they can be installed in .egg form, then
> setuptools can do it for you, as I described above.

This seems the best solution, thanks.

However, I would like to put the data in a *sub* project, that is know
only to my project setup.  Unfortunately this seems to not be possible.

Creating a "public" project for this does not feel right, to me.

I have some other questions.
Supposing that in the other PyPI project I still want to use a shell
script to download and process the data, is it correct to execute the
script in the setup.py script, before the setup function is called?

Since the shell script depends on some executables to be available on
the system (wget, tar, bzip2, imagemagick), is there a standard method
to check for existence of system executables in the setup?

Thanks  Manlio

More information about the Distutils-SIG mailing list