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

C. Titus Brown ctb at msu.edu
Thu Feb 25 08:19:23 PST 2010


On Thu, Feb 25, 2010 at 09:15:39AM -0500, Olemis Lang wrote:
> On Thu, Feb 25, 2010 at 6:02 AM, Nicolas Chauvat
> <nicolas.chauvat at logilab.fr> wrote:
> > 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.
> >
> 
> Something like that is what I do, however I still need to enhance my
> current layout to consider other test scripts & artifacts (e.g.
> doctest scripts, FIT tables, ... i.e. every executable test
> specification that's not directly executable 'cause it's not a python
> script ;o)
> 
> In that case what are they ? Test data ?

"Thinks for which we will have no standard."

I don't know how common zc.buildout is, but it would be easy to use logic
such as this:

  "if there's a buildout.cfg, and it has a [test] section, run that for
   all other tests."

--titus
-- 
C. Titus Brown, ctb at msu.edu



More information about the testing-in-python mailing list