[Distutils] unpacking files from and egg only for testing
Phillip J. Eby
pje at telecommunity.com
Sun May 13 18:23:04 CEST 2007
At 04:01 PM 5/13/2007 +0100, Alexander Schmolck wrote:
>Hi,
>
>I'm currently working on a package <http://www.scipy.org/MlabWrap> making the
>move from distutils to setuptools and I've got the following problem: although
>the code itself should work fine out of an egg, testing requires some a
>directory with some files to be created for matlab. Since it's only needed for
>testing I don't want to clutter the installers HD.
>
>How should I best handle this? Currently I'm just using ``zip_safe=False``,
>but a more elegant solution would seem to be for the test-code to temporarily
>unpack the relevant files from the egg into some temp-dir run the tests and
>delete the temp files again.
Use pkg_resources.resource_filename() - it will give you a real
filename for the resource (unpacked to a temporary directory if
necessary). If you are running "setup.py test", on the other hand,
it will return the path to the original source file.
More information about the Distutils-SIG
mailing list