← Back to team overview

u1db-discuss team mailing list archive

'bzr u1dbtest'

 

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I don't know if many of you realize, but bzr has a pretty comprehensive
test suite (28502 tests as of right now). It also has a very nice
testing infrastructure, including test runner, etc.

So I hacked together a bzr plugin "bzr-u1dbtest" available from
lp:~jameinel/u1db/bzr-u1dbtest. You can install it by doing:
 mkdir -p ~/.bazaar/plugins
 cd ~/.bazaar/plugins
 bzr co lp:~jameinel/u1db/bzr-u1dbtest u1dbtest

It then provides a new bzr command:

  bzr u1dbtest

Which will run the u1db test suite in the current directory. The big
things that it gets you are:

1) Progress bar while the tests are running, rather than no output.
2) -v support to show each test as it runs, along with how long the test
took.
3) Regex based filtering of tests to run "bzr u1dbtest sync".
4) Prefix based filtering of tests to run "bzr u1dbtest -s ut.test_sync"
(this is a bit more important in bzr, where identifying the 25k tests
that might be run takes a couple seconds, so this allows you to
not-even-load tests that don't match the prefix.)
5) Profiling of tests "bzr u1dbtest --lsprof-tests -v" will give you the
cProfile/lsprof for every test that is run.
6) "bzr u1dbtest --parallel=fork" will run the test suite in parallel.
Not a big deal today, though running 'trunk' I'm able to get 1.5s
instead of 2.3s using --parallel.

I really wish that more of bzrlib's infrastructure was pulled out into
stuff like testtools, but really it is just very well polished and
integrated together, and I haven't encountered something as nice
anywhere else.

So I decided to use it :)

I'll make sure that 'make' still runs the whole test suite. However, as
we grow a bigger test suite, it will soon take longer than 1s to run the
whole thing. And when you're doing TDD, it is important to have your
write-code test-code cycle time as fast as possible, so you don't get
distracted and go check your email or surf the web.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk65SdsACgkQJdeBCYSNAAMLpQCfRJxhmktea6y2K4O+eGo9bSvy
4dEAn0mpfiuVBdR4oes4aYNJpkT85fo9
=6dvK
-----END PGP SIGNATURE-----