[TIP] Guidelines for where to put tests & how to package them
DICAD - Rex Turnbull
rex at dicad.de
Thu Feb 25 02:10:14 PST 2010
Matt Harrison wrote:
> On Wed, Feb 24, 2010 at 10:01 PM, C. Titus Brown <ctb at msu.edu> wrote:
>
>> Hi all,
>>
>> [snip]
> I'm guessing, if there are "data" directories needed for tests they
> should be found under test/ as well.
our practice is to have a directory 'somepackage/tests/testdata' and
with that, any files are prefixed with the module name and somtimes with
reference to the test they are used for. If further structure is needed,
it goes down from testdata. This also makes it easy to have a simple
standard function 'get_testdata_path' that works for all packages.
(note: we use 'tests')
+somepackage
|-figure.py
|-think.py
|-+tests
|--test_figure.py
|--test_think.py
|--+testdata
|---figure.dat
|---figure.xyz
|---think_oldway.dat
Cheers,
Rex
More information about the testing-in-python
mailing list