<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Dear Clark and Henry,<br>
      <br>
      I appreciated so much for you guys information, <br>
      it works like a champ!
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
      <br>
      <br>
      Thanks again!<br>
      <br>
      Best regards,<br>
      <br>
      Jason<br>
      <br>
      On 6/7/13 9:24 PM, Clark Boylan wrote:<br>
    </div>
    <blockquote
cite="mid:CAAcH74gTLG7FqZ5M7BBhoCzn_K+5STf+H1TxEhzLNhicDaX=VQ@mail.gmail.com"
      type="cite">
      <pre wrap="">On Fri, Jun 7, 2013 at 6:08 PM, Henry Gessau <a class="moz-txt-link-rfc2396E" href="mailto:gessau@cisco.com"><gessau@cisco.com></a> wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">tox creates a virtualenv in .tox/py27 which you should activate for
debugging. Then use nosetests for running the test(s) in the debugger. Note,
with nosetests you must use a colon when splitting from the module to the
class level.

  $ source .tox/py27/bin/activate
  (py27)$ python -m pdb .tox/py27/bin/nosetests
quantum.tests.unit.test_debug_commands:TestDebugCommands

For some set_trace() tips, see
<a class="moz-txt-link-freetext" href="http://stackoverflow.com/questions/4950637/setting-breakpoints-with-nosetests-pdb-option">http://stackoverflow.com/questions/4950637/setting-breakpoints-with-nosetests-pdb-option</a>

-- Henry

On Fri, Jun 07, at 7:32 pm, Jason Zhang <a class="moz-txt-link-rfc2396E" href="mailto:bearovercloud@gmail.com"><bearovercloud@gmail.com></a> wrote:
</pre>
        <blockquote type="cite">
          <pre wrap="">Hi,

I'd like to debug the quantum unit test case using the pdb, but it looks
like I got the errors regarding the
stdin/stdout for i/o of pdb when I run the command as followings,

tox -e py27 -- quantum.tests.unit.test_debug_commands.TestDebugCommandsShell

Traceback (most recent call last):
  File "/opt/stack/quantum/quantum/tests/unit/test_debug_commands.py", line 417, in test_initialize_app_help_return
    sh.run(argv)
  File "/opt/stack/quantum/quantum/tests/unit/test_debug_commands.py", line 417, in test_initialize_app_help_return
    sh.run(argv)
  File "/usr/lib/python2.7/bdb.py", line 48, in trace_dispatch
    return self.dispatch_line(frame)
  File "/usr/lib/python2.7/bdb.py", line 67, in dispatch_line
    if self.quitting: raise BdbQuit
BdbQuit

</pre>
        </blockquote>
      </blockquote>
      <pre wrap="">Tox runs the unittests with testr which runs tests in parallel. This
makes dealing with stdout/stderr a little tricky. The current easy way
to use pdb without needing to manually source virtualenv's and run
nose is to do `./run_tests.sh -d` (you can also provide the specific
test here). This runs the tests with testtools.run which does not run
tests in parallel so we don't have to do funny things with
stdout/stderr. That said sourcing the virtualenv and running things
directly can be valuable as it much more flexible.

Clark

_______________________________________________
OpenStack-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a>
<a class="moz-txt-link-freetext" href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>