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

Vishvananda Ishaya vishvananda at gmail.com
Fri Jun 20 15:30:09 UTC 2014


This isn’t an officially supported method, but i tend to use:

python -m nova.openstack.common.lockutils nosetests <test>

for example:

python -m nova.openstack.common.lockutils nosetests nova.tests.integrated.test_api_samples:CloudPipeSampleJsonTest.test_cloud_pipe_create

I think this is a little bit less flexible than testtools run but old habits.

Vish

On Jun 12, 2014, at 3:59 AM, Daniel P. Berrange <berrange at redhat.com> wrote:

> 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
>   ...snip...
>   real	0m32.923s
>   user	0m22.083s
>   sys	0m4.377s
> 
> 
>   # time ./run_tests.sh tests.virt.test_hardware
>   ...snip...
>   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.
> 
> Regards,
> Daniel
> -- 
> |: 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 :|
> 
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140620/3928a5b2/attachment.pgp>


More information about the OpenStack-dev mailing list