[openstack-dev] ipdb debugging in Neutron test cases?

Roman Podolyaka rpodolyaka at mirantis.com
Wed Jul 17 04:00:11 UTC 2013


Hi,

Ensure that stdout isn't captured by the corresponding fixture:

OS_STDOUT_CAPTURE=0 python -m testtools.run
neutron.tests.unit.openvswitch.test_ovs_neutron_agent.TestOvsNeutronAgent.test_port_update
Tests running...
>
/home/rpodolyaka/src/neutron/neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py(251)test_port_update()
    250
--> 251         with contextlib.nested(
    252             mock.patch.object(self.agent.int_br,
"get_vif_port_by_id"),


OS_STDOUT_CAPTURE=1 python -m testtools.run
neutron.tests.unit.openvswitch.test_ovs_neutron_agent.TestOvsNeutronAgent.test_port_update
Tests running...
======================================================================
ERROR:
neutron.tests.unit.openvswitch.test_ovs_neutron_agent.TestOvsNeutronAgent.test_port_update
----------------------------------------------------------------------
Empty attachments:
  pythonlogging:''
  stdout

Traceback (most recent call last):
  File "neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py", line
248, in test_port_update
    import ipdb

(....)

AttributeError: '_io.BytesIO' object has no attribute 'name'

Thanks,
Roman


On Wed, Jul 17, 2013 at 5:58 AM, Qiu Yu <unicell at gmail.com> wrote:

> Hi,
>
> I'm wondering is there any one ever tried using ipdb in Neutron test
> cases? The same trick that used to be working with Nova, cannot be
> applied in Neutron.
>
> For example, you can trigger one specific test case. But once ipdb
> line is added, following exception will be raised from ipython.
>
> Any thoughts? How can I make ipdb work with Neutron test case? Thanks!
>
> $ source .venv/bin/activate
> (.venv)$ python -m testtools.run
>
> quantum.tests.unit.openvswitch.test_ovs_quantum_agent.TestOvsQuantumAgent.test_port_update
>
> ======================================================================
> ERROR:
> quantum.tests.unit.openvswitch.test_ovs_quantum_agent.TestOvsQuantumAgent.test_port_update
> ----------------------------------------------------------------------
> Empty attachments:
>   pythonlogging:''
>   stderr
>   stdout
>
> Traceback (most recent call last):
>   File "quantum/tests/unit/openvswitch/test_ovs_quantum_agent.py",
> line 163, in test_port_update
>     from ipdb import set_trace; set_trace()
>   File
> "/opt/stack/quantum/.venv/local/lib/python2.7/site-packages/ipdb/__init__.py",
> line 16, in <module>
>     from ipdb.__main__ import set_trace, post_mortem, pm, run,
> runcall, runeval, launch_ipdb_on_exception
>   File
> "/opt/stack/quantum/.venv/local/lib/python2.7/site-packages/ipdb/__main__.py",
> line 26, in <module>
>     import IPython
>   File
> "/opt/stack/quantum/.venv/local/lib/python2.7/site-packages/IPython/__init__.py",
> line 43, in <module>
>     from .config.loader import Config
>   File
> "/opt/stack/quantum/.venv/local/lib/python2.7/site-packages/IPython/config/__init__.py",
> line 16, in <module>
>     from .application import *
>   File
> "/opt/stack/quantum/.venv/local/lib/python2.7/site-packages/IPython/config/application.py",
> line 31, in <module>
>     from IPython.config.configurable import SingletonConfigurable
>   File
> "/opt/stack/quantum/.venv/local/lib/python2.7/site-packages/IPython/config/configurable.py",
> line 26, in <module>
>     from loader import Config
>   File
> "/opt/stack/quantum/.venv/local/lib/python2.7/site-packages/IPython/config/loader.py",
> line 27, in <module>
>     from IPython.utils.path import filefind, get_ipython_dir
>   File
> "/opt/stack/quantum/.venv/local/lib/python2.7/site-packages/IPython/utils/path.py",
> line 25, in <module>
>     from IPython.utils.process import system
>   File
> "/opt/stack/quantum/.venv/local/lib/python2.7/site-packages/IPython/utils/process.py",
> line 27, in <module>
>     from ._process_posix import _find_cmd, system, getoutput, arg_split
>   File
> "/opt/stack/quantum/.venv/local/lib/python2.7/site-packages/IPython/utils/_process_posix.py",
> line 27, in <module>
>     from IPython.utils import text
>   File
> "/opt/stack/quantum/.venv/local/lib/python2.7/site-packages/IPython/utils/text.py",
> line 29, in <module>
>     from IPython.utils.io import nlprint
>   File
> "/opt/stack/quantum/.venv/local/lib/python2.7/site-packages/IPython/utils/io.py",
> line 78, in <module>
>     stdout = IOStream(sys.stdout, fallback=devnull)
>   File
> "/opt/stack/quantum/.venv/local/lib/python2.7/site-packages/IPython/utils/io.py",
> line 42, in __init__
>     setattr(self, meth, getattr(stream, meth))
> AttributeError: '_io.BytesIO' object has no attribute 'name'
>
>
> --
> Qiu Yu
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20130717/7eae7d4a/attachment.html>


More information about the OpenStack-dev mailing list