[TIP] Guidelines for where to put tests & how to package them

C. Titus Brown ctb at msu.edu
Wed Feb 24 21:46:25 PST 2010

On Wed, Feb 24, 2010 at 10:18:20PM -0700, Matt Harrison wrote:
> On Wed, Feb 24, 2010 at 10:01 PM, C. Titus Brown <ctb at msu.edu> wrote:
> > Hi all,
> >
> > here at PyCon there have been a lot of packaging discussions, so I thought
> > I'd spend a bit of time outlining some suggestions for where to put
> > tests and how to run them. ?It's been a bit of a thorn in the side of
> > (among other things) continuous integration systems that there's no
> > standard way to run Python tests... so let's fix that!
> >
> > I've produced a simple draft proposal & example where you put your unit tests
> > under a package dir, somepackage/tests/.
> >
> > You can run these tests with
> >
> > ?% python -m somepackage.tests.run
> >
> On Wed, Feb 24, 2010 at 10:01 PM, C. Titus Brown <ctb at msu.edu> wrote:
> > Hi all,
> snip, snip
> > Comments?  Thoughts?  Complaints?  Issues I missed?
> >
> Looks good to me.  I'm all in favor of standards, and this should be a
> boon to CI, and distributors as well (if they can just blow away the
> test dir without worry).

Yes -- I should say that requirement emerged from discussions with
Sean Reifschneider (tummy.com, installer of production packages) and a RedHat
packager, and I gather that those constituencies would be happy with
this plan -- both a convention for running the tests during build, and
a convention for getting rid of them for install.

> I'm guessing, if there are "data" directories needed for tests they
> should be found under test/ as well.  You might want to explicitly
> state that, and maybe give an example of the convolution required to
> make that work.

ok.  Eventually that will be changing too, with the distutils2 code, but for
now we're stuck with the existing convolutions...

C. Titus Brown, ctb at msu.edu

More information about the testing-in-python mailing list