[TIP] Guidelines for where to put tests & how to package them
C. Titus Brown
ctb at msu.edu
Thu Feb 25 05:51:26 PST 2010
On Thu, Feb 25, 2010 at 12:02:49PM +0100, Nicolas Chauvat wrote:
> 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
;) nice plug!
> > 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.
OK -- so the convention I outlined would ask you to rename your test directory
to 'tests/', I think.
--titus
--
C. Titus Brown, ctb at msu.edu
More information about the testing-in-python
mailing list