← Back to team overview

gtg-user team mailing list archive

Re: Unittests for gtg

 

Just came across this in the mailing list archives...

On Mon, 9 Mar 2009 12:10:04 +0100 (CET), "Lionel Dricot"
<ploum@xxxxxxxxx> wrote:
> What are the best practices regarding unit tests in python application ?
> Having a tests folder with a script that launch them all ? Anything else ?
> If you have the experience with that kind of stuff, please feel free to
> add the folders you want to the code and to submit a patch.

There are a lot of practices, and not everyone agrees which is best.

Here's a summary:
  - Include tests in the main package
  - Put them in a package called 'tests'
  - Give each of the modules names like 'test_foo', you probably want
one test module per real module
  - Have a single command that will run all tests, 'make check' is traditional.

Other things:
  - You can use an already-existing testrunner like trial, nose or
py.test or you can cobble one together yourself. The trade-off is
extra build dependency vs writing more test support code.
  - For things like backends, you probably want to have *one* set of
tests that run against *every* backend, as well as a set of tests for
each backend.

If you'd like, I can set all of this up. I'll probably wait until my
other patches are landed though, since I don't want to juggle too many
balls at once.

jml

PS. What does a fella have to do to get commit access around here? :-)