openstack team mailing list archive
-
openstack team
-
Mailing list archive
-
Message #13971
Re: [OpenStack][Nova] Issues with "run_tests.sh", no tests are run when "import libvirt is present"
I'm developing on custom branch and haven't updated the repository for at
least 3 weeks.
Do i fetch the lastest changes like this:
> git remote update
> git checkout master
> git pull origin master
git checkout <branch>
git pull master
?
On Mon, Jul 2, 2012 at 1:44 PM, Monty Taylor <mordred@xxxxxxxxxxxx> wrote:
>
>
> On 07/02/2012 08:43 AM, Leander Bessa Beernaert wrote:
> > So, if no system packages can be imported, how do you test the
> > "connection" class for the libvirt driver?
>
> We're working on that - but as I said, please try running tox -efull
> which _should_ run tests with libvirt support enabled.
>
> > 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')
> >
> >
> > Regards,
> > Leander
> >
> > On Mon, Jul 2, 2012 at 1:27 PM, Monty Taylor <mordred@xxxxxxxxxxxx
> > <mailto:mordred@xxxxxxxxxxxx>> wrote:
> >
> >
> >
> > On 07/02/2012 06:02 AM, Leander Bessa Beernaert wrote:
> > > Thanks, that let me see the real problem now:
> > >
> > > ./tools/with_venv.sh nosetests -svx nova
> > > nose.config: INFO: Set working dir to /home/gsd/nova/nova/tests
> > > nose.config: INFO: Working directory /home/gsd/nova/nova/tests
> > is a
> > > package; adding to sys.path
> > > nose.config: INFO: Ignoring files matching ['^\\.', '^_',
> > > '^setup\\.py$']
> > > nose.plugins.cover: INFO: Coverage report will include only
> > > packages: ['nova']
> > > nose.selector: INFO: /home/gsd/nova/nova/auth/opendj.sh is
> > > executable; skipped
> > > nose.selector: INFO: /home/gsd/nova/nova/auth/slap.sh is
> > executable;
> > > skipped
> > > nose.selector: INFO:
> > > /home/gsd/nova/nova/cloudpipe/bootscript.template is
> > executable; skipped
> > > Failure: ImportError (No module named libvirt) ... ERROR
> > >
> >
> ======================================================================
> > > ERROR: Failure: ImportError (No module named libvirt)
> > >
> >
> ----------------------------------------------------------------------
> > > Traceback (most recent call last):
> > > File
> > >
> >
> "/home/gsd/nova/.venv/local/lib/python2.7/site-packages/nose/loader.py",
> > > line 390, in loadTestsFromName
> > > addr.filename, addr.module)
> > > File
> > >
> >
> "/home/gsd/nova/.venv/local/lib/python2.7/site-packages/nose/importer.py",
> > > line 39, in importFromPath
> > > return self.importFromDir(dir_path, fqname)
> > > File
> > >
> >
> "/home/gsd/nova/.venv/local/lib/python2.7/site-packages/nose/importer.py",
> > > line 86, in importFromDir
> > > mod = load_module(part_fqname, fh, filename, desc)
> > > File "/home/gsd/nova/nova/test.py", line 41, in <module>
> > > from nova.tests import fake_flags
> > > File "/home/gsd/nova/nova/tests/fake_flags.py", line 24, in
> > <module>
> > > flags.DECLARE('compute_scheduler_driver',
> > 'nova.scheduler.multi')
> > > File "/home/gsd/nova/nova/flags.py", line 52, in DECLARE
> > > __import__(module_string, globals(), locals())
> > > File "/home/gsd/nova/nova/scheduler/multi.py", line 27, in
> > <module>
> > > from nova.scheduler import driver
> > > File "/home/gsd/nova/nova/scheduler/driver.py", line 53, in
> > <module>
> > > flags..DECLARE('libvirt_type',
> 'nova.virt.libvirt.connection')
> > > File "/home/gsd/nova/nova/flags.py", line 52, in DECLARE
> > > __import__(module_string, globals(), locals())
> > > File "/home/gsd/nova/nova/virt/libvirt/connection.py", line
> > 73, in
> > > <module>
> > > from nova.virt.libvirt import diagnostics as
> > libvirt_diagnostics
> > > File "/home/gsd/nova/nova/virt/libvirt/diagnostics.py", line
> 75,
> > > in <module>
> > > import libvirt as virt
> > > ImportError: No module named libvirt
> > >
> >
> ----------------------------------------------------------------------
> > > Ran 1 test in 0.002s
> > > FAILED (errors=1)
> > >
> > >
> > > Libvirt is present on my system, i can import it through the python
> > > interpreter from any location. Yet, it still says it is not
> present.
> > > Could this have to do with the virtual_env or fakelibvirt?
> >
> > Yes. Our virtualenvs are currently configured to not allow system
> > packages to be used (so that they only use python libs installed into
> > the virtualenv. However, libvirt is not installable via pip, which
> is a
> > problem.
> >
> > We've recently added a new tox environment to help with this, so try
> > running:
> >
> > tox -v -efull
> >
> > Which is set up to allow system site packages.
> >
> > However, if you're adding unittests, you should look at the other
> ones
> > which test for libvirt existence and skip the tests if they can't
> > find it.
> >
> > > On Fri, Jun 29, 2012 at 6:54 PM, Jay Pipes <jaypipes@xxxxxxxxx
> > <mailto:jaypipes@xxxxxxxxx>
> > > <mailto:jaypipes@xxxxxxxxx <mailto:jaypipes@xxxxxxxxx>>> wrote:
> > >
> > > Hi Leander,
> > >
> > > I've noticed some weirdness with the openstack.nose_plugin
> > (which is
> > > used by default for the Nova test runner) sometimes either
> > throwing
> > > errors (particularly errors raised by nosetests) away and/or
> > coming
> > > up with a different set of skip tests than when running just
> with
> > > nosetests.
> > >
> > > So, I'd recommend running just this:
> > >
> > > ./tools/with_venv.sh nosetests -svx nova
> > >
> > > That will stop at the first error and probably will give you
> > better
> > > insight into the actual errors that are likely being
> suppressed by
> > > the openstack nose plugin.
> > >
> > > best,
> > > -jay
> > >
> > >
> > > On 06/29/2012 09:02 AM, Leander Bessa Beernaert wrote:
> > >
> > > Hello,
> > >
> > > I'm sorry to restart the topic
> > > (https://lists.launchpad.net/__openstack/msg13621.html
> > > <https://lists.launchpad.net/openstack/msg13621.html>),
> but
> > > i accidentally deleted the message in my inbox :S.
> > >
> > > I'm still having the same problem, each time i add "import
> > > libvirt" to
> > > the file "diangostics.py"
> > > (https://review.openstack.org/__#/c/8839/
> > > <https://review.openstack.org/#/c/8839/>) the
> > > entire test suit won't run.
> > >
> > > *With the import* present i get the following output:
> > >
> > >
> > >
> > >
> >
> ------------------------------__------------------------------__----------
> > > Ran 0 tests in 0.000s
> > > OK Running PEP8 and HACKING compliance check....
> > > 2 imports missing in this test environment
> > >
> > >
> > > *Without the import *present it get this output:
> > >
> > >
> > >
> > >
> >
> ------------------------------__------------------------------__----------
> > > Ran 3030 tests in 233.326s
> > > OK (SKIP=22) Running PEP8 and HACKING compliance
> check...
> > > 11 imports missing in this test environment
> > >
> > >
> > >
> > > The problem now is that, according to the OpenStack
> > conventions, the
> > > import must be present. However, with the import present i
> > can't
> > > get any
> > > of the tests to run.
> > > I'm no expert in Python, so could someone please help me
> > out here?
> > >
> > > Regards,
> > >
> > > Leander
> > >
> > >
> > > _________________________________________________
> > > Mailing list: https://launchpad.net/~__openstack
> > > <https://launchpad.net/~openstack>
> > > Post to : openstack@xxxxxxxxxxxxxxxxxxx
> > <mailto:openstack@xxxxxxxxxxxxxxxxxxx>
> > > <mailto:openstack@xxxxxxxxxxxxxxxxxxx
> > <mailto:openstack@xxxxxxxxxxxxxxxxxxx>>
> > > Unsubscribe : https://launchpad.net/~__openstack
> > > <https://launchpad.net/~openstack>
> > > More help : https://help.launchpad.net/__ListHelp
> > > <https://help.launchpad.net/ListHelp>
> > >
> > >
> > >
> > > _________________________________________________
> > > Mailing list: https://launchpad.net/~__openstack
> > > <https://launchpad.net/~openstack>
> > > Post to : openstack@xxxxxxxxxxxxxxxxxxx
> > <mailto:openstack@xxxxxxxxxxxxxxxxxxx>
> > > <mailto:openstack@xxxxxxxxxxxxxxxxxxx
> > <mailto:openstack@xxxxxxxxxxxxxxxxxxx>>
> > > Unsubscribe : https://launchpad.net/~__openstack
> > > <https://launchpad.net/~openstack>
> > > More help : https://help.launchpad.net/__ListHelp
> > > <https://help.launchpad.net/ListHelp>
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > Mailing list: https://launchpad.net/~openstack
> > > Post to : openstack@xxxxxxxxxxxxxxxxxxx
> > <mailto:openstack@xxxxxxxxxxxxxxxxxxx>
> > > Unsubscribe : https://launchpad.net/~openstack
> > > More help : https://help.launchpad.net/ListHelp
> > >
> >
> >
>
>
Follow ups
References
-
[OpenStack][Nova] Issues with "run_tests.sh", no tests are run when "import libvirt is present"
From: Leander Bessa Beernaert, 2012-06-29
-
Re: [OpenStack][Nova] Issues with "run_tests.sh", no tests are run when "import libvirt is present"
From: Jay Pipes, 2012-06-29
-
Re: [OpenStack][Nova] Issues with "run_tests.sh", no tests are run when "import libvirt is present"
From: Leander Bessa Beernaert, 2012-07-02
-
Re: [OpenStack][Nova] Issues with "run_tests.sh", no tests are run when "import libvirt is present"
From: Monty Taylor, 2012-07-02
-
Re: [OpenStack][Nova] Issues with "run_tests.sh", no tests are run when "import libvirt is present"
From: Leander Bessa Beernaert, 2012-07-02
-
Re: [OpenStack][Nova] Issues with "run_tests.sh", no tests are run when "import libvirt is present"
From: Monty Taylor, 2012-07-02