[TIP] Nose questions

Toby White toby.o.h.white at googlemail.com
Fri Sep 5 04:55:53 PDT 2008


(apologies if there is a better, more nose-specific place to send  
questions, but I couldn't find one)

I've recently started with nose, which is mostly fine so far, but I've  
two questions on its use - I'd be grateful for any pointers.


1) How do I use nose, doctests & pdb together. The docs seem to  
suggest ought to be possible, but I can't work out how.
If I put the standard "import pdb;pdb.set_trace()" in my doctests, and  
run them through nose, all that happens is that nose hangs; Ctrl-C-ing  
it reveals that it's waiting inside pdb for input, but nose has  
presumably done something with stdin/stdout

$ nosetests -vv --with-doctest nullNugget.py
Doctest: nullNugget.Nugget ... ^CTraceback (most recent call last):
  File "/usr/local/bin/nosetests", line 8, in <module>
    load_entry_point('nose==0.10.3', 'console_scripts', 'nosetests')()
[...]
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/doctest.py", line 328, in trace_dispatch
    return pdb.Pdb.trace_dispatch(self, *args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/bdb.py", line 52, in trace_dispatch
    return self.dispatch_return(frame, arg)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/bdb.py", line 85, in dispatch_return
    self.user_return(frame, arg)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/pdb.py", line 170, in user_return
    self.interaction(frame, None)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/pdb.py", line 187, in interaction
    self.cmdloop()
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/cmd.py", line 136, in cmdloop
    line = self.stdin.readline()
KeyboardInterrupt



2) Can I use attribute selectors with doctests?


Toby



More information about the testing-in-python mailing list