On 2/23/06, Stephan Richter <srichter@cosmos.phy.tufts.edu> wrote:
How do you want to use the debugger?
I'd like to be able to step through the tests.
I run the tests, if the set_trace() occurs it throws me to the prompt and all is fine. I can use the debugger as usual.
When I do this, I get a prompt. Pressing next returns to the running of the tests, not the next line of the test. Here is an example: >>> import pdb;pdb.set_trace() >>> gsm = zope.component.getGlobalSiteManager() >>> gsm.provideUtility(I1, ob) >>> gsm.provideUtility(I11, ob11) When I run this, my debuggning session looks like this: $ bin/zopetest --dir zope/component Running unit tests: --Return--
/opt/Zope-3.2.0/lib/python/zope/testing/doctest.py(351)set_trace()->None -> pdb.Pdb.set_trace(self) (Pdb) s --Return-- <doctest zope.component.tests.test_getAllUtilitiesRegisteredFor[4]>(1)?()->None -> import pdb;pdb.set_trace() (Pdb) s /opt/Zope-3.2.0/lib/python/zope/testing/doctest.py(1257)__run() -> self.debugger.set_continue() # ==== Example Finished ==== (Pdb) s --Call-- /opt/Zope-3.2.0/lib/python/zope/testing/doctest.py(353)set_continue() -> def set_continue(self): (Pdb) s /opt/Zope-3.2.0/lib/python/zope/testing/doctest.py(356)set_continue() -> if self.__debugger_used: (Pdb) s /opt/Zope-3.2.0/lib/python/zope/testing/doctest.py(357)set_continue() -> pdb.Pdb.set_continue(self) (Pdb) s --Call-- /usr/lib/python2.4/bdb.py(196)set_continue() -> def set_continue(self): (Pdb) s /usr/lib/python2.4/bdb.py(198)set_continue() -> self.stopframe = self.botframe (Pdb) s
As you see, I can't even step into that next line. And even if I could, the necessity of having to step through the doctestrunning would be a major pain in the ass. Here is a non-doctest exampe as comparison. This is what I want: import pdb;pdb.set_trace() sm = zapi.getSiteManager() sm.registerUtility(IDummyUtility, dummy1) sm.registerUtility(IDummyUtility, dummy2) -> sm = zapi.getSiteManager() (Pdb) n
/home/zopes/cps34/Products/Five/site/tests/test_utility.py(209)test_registeringTwiceIsConflict() -> sm.registerUtility(IDummyUtility, dummy1) (Pdb) n /home/zopes/cps34/Products/Five/site/tests/test_utility.py(210)test_registeringTwiceIsConflict() -> sm.registerUtility(IDummyUtility, dummy2) (Pdb) s --Call-- /home/zopes/cps34/Products/Five/site/localsite.py(147)registerUtility() -> def registerUtility(self, interface, utility, name=''): (Pdb)
I can't seem to be able to do this.
There used to be an issue with the debugger not displaying anything, since doctests mess with stdout and that has been fixed. This is what Benji and I were talking about.
Oh. -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/