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

Nicolas Chauvat nicolas.chauvat at logilab.fr
Thu Feb 25 03:02:49 PST 2010


Hi,

On Wed, Feb 24, 2010 at 10:18:20PM -0700, Matt Harrison wrote:
> > 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!

Nice.

This would definitely make things easier for a tool like
http://www.logilab.org/project/apycot

> 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.

At Logilab, we have doing this with:

myproject/
  |- *.py
  ...
  \- test/
      |- test_something.py
      ...
      \- data/
          |- somedata.txt
          |- someimage.png
          ...

and the pytest executable that comes with logilab.common discovers the
tests and executes them.

-- 
Nicolas Chauvat

logilab.fr - services en informatique scientifique et gestion de connaissances  



More information about the testing-in-python mailing list