launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #04495
Re: How to run a few unit tests a bit faster
On Thu, 26 Aug 2010 11:31:13 +0100, Julian Edwards <julian.edwards@xxxxxxxxxxxxx> wrote:
> 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.
Ah, yes indeed. As Bjorn points out though, if you can remember the
name of the module that loads the doctest you want, you can run
something like:
./bin/test -vvc canonical.launchpad.ftests.test_system_documentation -t $doctest
I have to admit I don't actually do this, though maybe I'll start now...
Cheers,
mwh
References