[Distutils] questions re: data files with Distribute's test

Chris Jerdonek chris.jerdonek at gmail.com
Mon Apr 9 11:51:35 CEST 2012


I have a few questions about including data files when running

    python setup.py test

with Distribute while using Python 3 and the "use_2to3" keyword argument.

Some of my test files are in a subdirectory of my project outside of
the package directory.  I'm able to have the test files copied over to
the build directory when running "test" by including a package_data
argument something like the following:

package_data = {'package': ['../path/to/test/data/*.json']}

My questions are--

(1) Is it acceptable to be using parent directories to reference files
outside the package directory, or is there a better way to reference
paths relative to the project root?  Perhaps data_files?

(2) Is there an easy way to make it so that these data files get
copied only when the test command is being run?  The files aren't
needed when not developing.

(3) Are there any best practices around including/installing test
files in distributions (or should they be left out)?

Thanks,
--Chris


More information about the Distutils-SIG mailing list