[openstack-dev] [nova] fastest way to run individual tests ?

Daniel P. Berrange berrange at redhat.com
Thu Jun 12 10:59:56 UTC 2014

When in the middle of developing code for nova I'll typically not wish to
the run the entire Nova test suite every time I have a bit of code to
verify. I'll just want to run the single test case that deals with the
code I'm hacking on.

I'm currently writing a 'test_hardware.py' test case for the NUMA work
I'm dealing with. I can run that using 'run_tests.sh' or 'tox' by just
passing the name of the test case. The test case in question takes a tiny
fraction of a second to run, but the tox command above wastes 32 seconds
faffing about before it runs the test itself, while run_tests.sh is not
much better wasting 22 seconds.

   # tox -e py27  tests.virt.test_hardware
   real	0m32.923s
   user	0m22.083s
   sys	0m4.377s

   # time ./run_tests.sh tests.virt.test_hardware
   real	0m22.075s
   user	0m14.282s
   sys	0m1.407s

This is a really severe time penalty to incurr each time I want to run
this tiny test (which is very frequently during dev).

Does anyone have any tip on how to actually run individual tests in an
efficient manner. ie something that adds no more than 1 second penalty
over & above the time to run the test itself. NB, assume that i've primed
the virtual env with all prerequisite deps already.

|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

More information about the OpenStack-dev mailing list