[openstack-dev] [nova] running pep8 tests much faster

Daniel P. Berrange berrange at redhat.com
Mon Aug 18 11:51:47 UTC 2014

We recently had a change merged to the run_tests.sh script that Nova
developers would really benefit from knowing about:


Basically, it provides a way to run the pep8 tests *only* against the files
which you have actually touched in your patch. For most patches this has a
huge benefit in running time since instead of checking 3000+ files it only
has to check a handful.

Old way, checking all of nova codebase at once:

$ time ./run_tests.sh -p
  Running flake8 ...

  real	2m4.410s
  user	2m3.530s
  sys	0m0.637s

New way, checking only changed files:

  $ time ./run_tests.sh -8
  Running flake8 on nova/tests/virt/libvirt/test_driver.py nova/virt/libvirt/driver.py 

  real	0m8.117s
  user	0m7.785s
  sys	0m0.287s

I'm guessing I know which most people will prefer :)

NB, this only checks files in the most recent patch in your checkout. ie
if you are sitting on a 10-patch series it is only validating the last
patch in that series. Probably not an issue for most people since you
need to explicitly check each patch individually during rebase regardless.

In summary, you can change 'run_tests.sh -p' to 'run_tests.sh -8' and be
generally much happier :-)

|: 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