← Back to team overview

launchpad-dev team mailing list archive

Re: Faster TDD cycle: persist test services between test runs

 

On Monday 01 March 2010 12:59:38 Bjorn Tillenius wrote:
> If you're into TDD, you're probably a bit annoyed about Librarian and
> Memcached taking quite a while to set up and tear down when running the
> tests, right? Well, these are things that we usually don't change, so
> there's not much point in keep starting and stopping them every time you
> run a test.
> 
> If you specify LP_PERSISTENT_TEST_SERVICES=1 in the environment (for
> example in .bashrc), the Librarian and Memcached daemons won't be shut
> down when the test run ends. And the next time you run a test, the test
> harness will see that those services are running, and won't try to start
> them again.
> 
> If you need to kill them, you can use bin/kill-test-services.
> 
> You can see that this work by making sure that it takes around 0 seconds
> to set up and tear down LibrarianLayer and MemcachedLayer when running
> bin/test -vv -t some-test.

\o/

Thanks for this Bjorn.  I saw you demo this in Wellington and was wondering 
when the announcement would come :)

> Another good tips is to always specify. -m to the test runner. If you
> run a test in lp.bugs for example, specifying -m lp.bugs will make the
> test discovery much faster.
 
Also avoid using -t which causes a search of all the tests to see what to 
match on.  If I can, I often do:

bin/test -cvv <filename>  (without the .py)

which starts up really quickly and just runs the tests in that file.

You can't avoid using -t to run doc and page tests though AFAIK (?)



Follow ups

References