简体   繁体   中英

PyDev Setting breakpoints in doctests

Is it possible to set breakpoints in doctests, using PyDev (ie eclipse)? I found that while I am seemingly able to do so, the breakpoints do not work at all.

To have some code in the question, and to clarify, say I have

def funct():
  """
  >>> funct()
  Whatever
  """
  print "Whatever"

and that I set a breakpoint at the funct() call in the doctest. Can I do that?

PS: I know I can do

>>> import pdb; pdb.set_trace()

to have a prompt in a doctest, but I would prefer not inserting such lines.

I don't think you can set breakpoints in strings.

doctest is a module for automated testing. If you need to debug your doctest code, why not run it normally and verify the output, then once you know it works, throw it into a docstring?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM