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

C. Titus Brown ctb at msu.edu
Thu Feb 25 08:22:48 PST 2010


On Thu, Feb 25, 2010 at 09:56:30AM -0500, Olemis Lang wrote:
> On Thu, Feb 25, 2010 at 12:01 AM, C. Titus Brown <ctb at msu.edu> 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!
> 
> We're gonna save the world . Great !

Heh, "one time flat fee!"

> > Comments?
> 
> It's great for the start, but I prefer `python setup.py test -m
> somepackage.test.run` (not sure about `test.run` yet ...) for testing
> everything in there, because it's more explicit, promotes a well known
> set of command line arguments and relieson distutils commands (and you
> can see by just looking at the command line ;o), so the command can
> perform a build or take whatever action it needs in order to satisfy
> the preconditions needed to run tests (e.g. installing ). Sometimes
> it's also useful to test just a well-known subset of what's been done
> (e.g. GViz QL Python client library that's implemented inside TracGviz
> plugin ;o) . In that case using -s or similar is useful.

Hmm, I'm just going to have to call "WTF" on you here:

  python setup.py test -m somepackage.test ...

This has several problems, now that I've retroactively defined my
conditions -- see my response to Robert.  The problems:

 - requires distutils extension for 'test' command
 - is potentially redundant or at least contains unnecessary information
   ('test, plus, run this')
 - confuses arguments to the setup.py test command with arguments to
   python (what does '-m' go with -- python, or setup.py, or test?)

So -1 on this from me!

> > Complaints?
> 
> How could anybody complain ?

...obviously you haven't attended PyCon lately.

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



More information about the testing-in-python mailing list