[Openstack] Issue in running unit test with Neutron
Narasimhan, Vivekanandan
vivekanandan.narasimhan at hp.com
Tue Apr 29 18:30:08 UTC 2014
Hi Henry/Romil,
Thanks Henry. We are still hitting problems tox -e py27 neutron.tests.unit.test_l3_agent.
It hangs on to fill all the libraries in test/requirements.txt, and doesn't seem to return the prompt.
In the meantime I tried this on a different terminal:
./run_tests.sh -d -N neutron.tests.unit.ml2.test_ml2_plugin
Ran 147 tests in 86.697s
OK
And it worked for me.
--
Thanks,
Vivek
-----Original Message-----
From: Henry Gessau [mailto:gessau at cisco.com]
Sent: Tuesday, April 29, 2014 7:12 AM
To: openstack at lists.openstack.org
Subject: Re: [Openstack] Issue in running unit test with Neutron
Neutron uses tox as the defacto standard method for running unit tests. If
you don't have tox you install it like this:
sudo pip install -U tox==1.6.1
The version locking is required because of some incompatibility with newer
versions. (The incompatibility may be fixed, but I am still using 1.6.1.)
To run unit tests:
# all neutron unit tests (takes a very long time)
tox -e py27
# just the tests in test_l3_agent.py
tox -e py27 neutron.tests.unit.test_l3_agent
Using run_test.sh is intended to work but if there are problems with it they
are sometimes discovered late because fewer people use it. That said, I just
ran the following and had no problems:
./run_tests.sh neutron.tests.unit.ml2.test_ml2_plugin
However, before this I had already run tox, which create a virtual
environment which run_tests.sh seems to pick up.
If you want to discuss more details of neutron unit tests feel free to post
your questions to the openstack-dev mailing list with [neutron] in the subject.
On Tue, Apr 29, at 8:57 am Romil Gupta (romilgupta19 at gmail.com) wrote:
> Hi Guys ,
>
> Is this the expected output of run_tests.sh for ml2 :
>
> /romil at workspace:~/repos/openstack-neutron$ ./run_tests.sh -d
> neutron.tests.unit.ml2.test_ml2_plugin/
> /No virtual environment found...create one? (Y/n) n/
> /Tests running.../
> /2014-04-29 13:16:34,420 INFO [neutron.manager] Loading core plugin:
> neutron.plugins.ml2.plugin.Ml2Plugin/
> /2014-04-29 13:16:34,420 INFO [neutron.plugins.ml2.managers] Configured
> type driver names: ['local', 'flat', 'vlan', 'gre', 'vxlan']/
> /2014-04-29 13:16:34,421 INFO [neutron.plugins.ml2.managers] Loaded type
> driver names: []/
> /2014-04-29 13:16:34,421 INFO [neutron.plugins.ml2.managers] Registered
> types: []/
> /2014-04-29 13:16:34,421 ERROR [neutron.plugins.ml2.managers] No type
> driver for tenant network_type: local. Service terminated!/
> /
> /
> /Ran 1 test in 0.226s/
> /OK/
> /No type driver for tenant network_type: local. Service terminated!/
>
>
>
> On Mon, Apr 28, 2014 at 3:26 PM, Romil Gupta <romilgupta19 at gmail.com
> <mailto:romilgupta19 at gmail.com>> wrote:
>
> I also tried running unit test with run_test.sh and getting the
> following error :
>
> /root at romil-workspace:~/neutron-openstack# ./run_tests.sh -d -N
> neutron.tests.unit.test_l3_agent/
> /Traceback (most recent call last):/
> / File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main/
> / "__main__", fname, loader, pkg_name)/
> / File "/usr/lib/python2.7/runpy.py", line 72, in _run_code/
> / exec code in run_globals/
> / File "/usr/local/lib/python2.7/dist-packages/testtools/run.py", line
> 399, in <module>/
> / main(sys.argv, sys.stdout)/
> / File "/usr/local/lib/python2.7/dist-packages/testtools/run.py", line
> 396, in main/
> / stdout=stdout)/
> / File "/usr/local/lib/python2.7/dist-packages/testtools/run.py", line
> 206, in __init__/
> / self.parseArgs(argv)/
> / File "/usr/local/lib/python2.7/dist-packages/testtools/run.py", line
> 283, in parseArgs/
> / self.createTests()/
> / File "/usr/local/lib/python2.7/dist-packages/testtools/run.py", line
> 292, in createTests/
> / self.module)/
> / File "/usr/lib/python2.7/unittest/loader.py", line 128, in
> loadTestsFromNames/
> / suites = [self.loadTestsFromName(name, module) for name in names]/
> / File "/usr/lib/python2.7/unittest/loader.py", line 100, in
> loadTestsFromName/
> / parent, obj = obj, getattr(obj, part)/
> /AttributeError: 'module' object has no attribute 'test_l3_agent'/
> /
> /
>
> Need help ....
>
>
> On Mon, Apr 28, 2014 at 3:09 PM, Romil Gupta <romilgupta19 at gmail.com
> <mailto:romilgupta19 at gmail.com>> wrote:
>
> Hi Guys,
>
> I am facing issue in running unit test with nose in neutron.
>
> /root at romil-workspace:~/neutron-openstack/neutron/tests/unit/ml2#
> nosetests test_ml2_plugin.py/
> /E/
> /======================================================================/
> /ERROR: Failure: ImportError (cannot import name
> server_external_events)/
> /----------------------------------------------------------------------/
> /Traceback (most recent call last):/
> / File "/usr/local/lib/python2.7/dist-packages/nose/loader.py",
> line 413, in loadTestsFromName/
> / addr.filename, addr.module)/
> / File "/usr/local/lib/python2.7/dist-packages/nose/importer.py",
> line 47, in importFromPath/
> / return self.importFromDir(dir_path, fqname)/
> / File "/usr/local/lib/python2.7/dist-packages/nose/importer.py",
> line 94, in importFromDir/
> / mod = load_module(part_fqname, fh, filename, desc)/
> / File
> "/root/neutron-openstack/neutron/tests/unit/ml2/test_ml2_plugin.py",
> line 29, in <module>/
> / from neutron.plugins.ml2 import plugin as ml2_plugin/
> / File "/root/neutron-openstack/neutron/plugins/ml2/plugin.py",
> line 27, in <module>/
> / from neutron.db import agentschedulers_db/
> / File "/root/neutron-openstack/neutron/db/agentschedulers_db.py",
> line 23, in <module>/
> / from neutron.db import agents_db/
> / File "/root/neutron-openstack/neutron/db/agents_db.py", line 24,
> in <module>/
> / from neutron.extensions import agent as ext_agent/
> / File "/root/neutron-openstack/neutron/extensions/agent.py", line
> 20, in <module>/
> / from neutron.api.v2 import base/
> / File "/root/neutron-openstack/neutron/api/v2/base.py", line 30,
> in <module>/
> / from neutron.notifiers import nova/
> / File "/root/neutron-openstack/neutron/notifiers/nova.py", line
> 19, in <module>/
> / from novaclient.v1_1.contrib import server_external_events/
> /ImportError: cannot import name server_external_events/
> /
> /
> /----------------------------------------------------------------------/
> /Ran 1 test in 0.001s/
> /
> /
> /FAILED (errors=1)/
>
>
> Please help me to fix this issue.
>
> Thanks in Advance for the help !
>
> --
> *Regards,*
> *Romil
> *
>
>
>
>
> --
> *Regards,*
> *Romil
> *
>
>
>
>
> --
> *Regards,*
> *Romil
> *
>
>
> _______________________________________________
> Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
> Post to : openstack at lists.openstack.org
> Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>
_______________________________________________
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack at lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
More information about the Openstack
mailing list