[Openstack] [OpenStack][Nova] Issues with "run_tests.sh", no tests are run when "import libvirt is present"

Daniel P. Berrange berrange at redhat.com
Mon Jul 2 14:26:52 UTC 2012


On Mon, Jul 02, 2012 at 01:43:31PM +0100, Leander Bessa Beernaert wrote:
> So, if no system packages can be imported, how do you test the "connection"
> class for the libvirt driver?
> 
> How does that particular test case wrap around the fact that it requires
> the libvirt module? The only thing i could find are these lines of code in
> the driver's __init__ method. Do these somehow detect if this is a unit
> test environment and import the fakelibvirt driver instead? I'm no expert
> in python so i'm not sure what's happening there :s
> 
> > global libvirt
> > if libvirt is None:
> >     libvirt = __import__('libvirt')

If you have installed all the neccessary python packages on your
local host, then it is entirely possible to run the Nova test
suites without using virtualenv. You just need to pass the '-N'
arg to the run_tests.sh script, eg on my Fedora 17 host, I can
run

   ./run_tests.sh -N nova.tests.test_libvirt

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




More information about the Openstack mailing list