← Back to team overview

launchpad-dev team mailing list archive

Re: How to run a few unit tests a bit faster

 

On Thursday 26 August 2010 04:15:26 Michael Hudson wrote:
> On Wed, 25 Aug 2010 21:58:55 -0400, Gary Poster <gary.poster@xxxxxxxxxxxxx> 
wrote:
> > I think most people use the -t option to bin/test to find tests to
> > run.  This finds all possible tests, and then filters.  If you are
> > only running some relatively svelte little tests without layer set up,
> > this can be very noticeable.
> > 
> > You might like -m and -p.  -m runs the tests in a module.  -p runs the
> > tests in a package.  For me on Launchpad, -t is about 3 times slower
> > than -m or -p.
> 
> What's the difference between passing -m or -p and not passing any
> option at all?  The following all run the same number of tests at the
> same speed afaict:
> 
> ./bin/test -p lp.codehosting.vfs.tests -u
> ./bin/test -m lp.codehosting.vfs.tests -u
> ./bin/test lp.codehosting.vfs.tests -u

I use no flags to match test files where I can.  So something like:

bin/test -cvv test_manager

runs my buildd-manager tests in lib/lp/buildmaster/tests/test_manager.py.  
Knowing this also influences my decisions about how to structure tests :)

The only time I use -t now is to run a particular doc test since they get 
loaded indirectly.

J



Follow ups

References