[openstack-dev] run_tests in debug mode fails

Clark Boylan clark.boylan at gmail.com
Wed Sep 11 03:43:34 UTC 2013


On Mon, Sep 9, 2013 at 4:20 AM, Rosa, Andrea (HP Cloud Services)
<andrea.rosa at hp.com> wrote:
> Hi all
>
> I need to debug a specific test but when I try to run it in debug mode using the "run_tests -d" (I need to attach pdb) that command fails but if I run the script without the "-d" option that works.
> I created a brand-new env so I don't think it's related to my local env.
> Anyone is experiencing the same issue?
> Should I file a nova bug for that?
>
> Error details:
> ./run_tests.sh -d nova.tests.integrated.test_servers.ServersTestV3.test_create_and_rebuild_server
> Traceback (most recent call last):
>   File "nova/tests/integrated/test_servers.py", line 43, in setUp
>     super(ServersTest, self).setUp()
>   File "nova/tests/integrated/integrated_helpers.py", line 87, in setUp
>     self.consoleauth = self.start_service('consoleauth')
>   File "nova/test.py", line 279, in start_service
>     svc = self.useFixture(ServiceFixture(name, host, **kwargs))
>   File "/home/ubuntu/nova/.venv/local/lib/python2.7/site-packages/testtools/testcase.py", line 591, in useFixture
>     fixture.setUp()
>   File "nova/test.py", line 174, in setUp
>     self.service = service.Service.create(**self.kwargs)
>   File "nova/service.py", line 245, in create
>     manager = CONF.get(manager_cls, None)
>   File "/home/ubuntu/nova/.venv/lib/python2.7/_abcoll.py", line 342, in get
>     return self[key]
>   File "/home/ubuntu/nova/.venv/local/lib/python2.7/site-packages/oslo/config/cfg.py", line 1610, in __getitem__
>     return self.__getattr__(key)
>   File "/home/ubuntu/nova/.venv/local/lib/python2.7/site-packages/oslo/config/cfg.py", line 1606, in __getattr__
>     return self._get(name)
>   File "/home/ubuntu/nova/.venv/local/lib/python2.7/site-packages/oslo/config/cfg.py", line 1930, in _get
>     value = self._substitute(self._do_get(name, group, namespace))
>   File "/home/ubuntu/nova/.venv/local/lib/python2.7/site-packages/oslo/config/cfg.py", line 1948, in _do_get
>     info = self._get_opt_info(name, group)
>   File "/home/ubuntu/nova/.venv/local/lib/python2.7/site-packages/oslo/config/cfg.py", line 2029, in _get_opt_info
>     raise NoSuchOptError(opt_name, group)
> NoSuchOptError: no such option: consoleauth_manager
>
> Ran 1 test in 11.296s
> FAILED (failures=1)
>
There are a couple interesting things going on here, and I haven't
quite untangled all of it. Basically the consoleauth_manager option
comes from nova.consoleauth.manager and when we don't import that
module the option isn't available to us. For some reason when running
`python -m subunit.run
nova.tests.integrated.test_servers.ServersTestV3.test_create_and_rebuild_server`
or `python -m testtools.run
nova.tests.integrated.test_servers.ServersTestV3.test_create_and_rebuild_server`
(this is what run_tests.sh -d does) nova.consoleauth.manager isn't
being imported, but when running `testr run
nova.tests.integrated.test_servers.ServersTestV3.test_create_and_rebuild_server`
it is. Not sure why there is a difference (possibly related to
discover?).

I did manage to confirm that the attached patch mostly fixes the
problem. It allows me to run the above commands out of the a tox built
virtualenv, but not a run_tests.sh built virtualenv. This is the other
piece of the puzzle that I haven't sorted yet. I do have a hunch it
has to do with how oslo.config is installed. As a work around you can
source the tox virtualenv then run run_tests.sh -N -d and that should
work given the attached patch. I would submit a change to Gerrit but
would like to understand more of what is going on first. If someone
else groks this more please feel free to submit the fix instead.

Clark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: integrated_helpers.patch
Type: application/octet-stream
Size: 496 bytes
Desc: not available
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20130910/8d243674/attachment.obj>


More information about the OpenStack-dev mailing list