开发者

PyDev Setting breakpoints in doctests

开发者 https://www.devze.com 2023-01-08 19:34 出处:网络
Is it possible to set breakpoints in doctests, using PyDev (i.e. eclipse)? I found that while I am seemingly able to do so, the breakpoints do not work at all.

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

To ha开发者_运维技巧ve 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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号