PyDev 在文档测试中设置断点
是否可以使用 PyDev (即 eclipse)在 doctests 中设置断点?我发现虽然我似乎能够做到这一点,但断点根本不起作用。
为了在问题中包含一些代码并澄清,假设我已经
def funct():
"""
>>> funct()
Whatever
"""
print "Whatever"
在 doctest 中的 funct() 调用处设置了一个断点。我可以这样做吗?
PS:我知道我可以
>>> import pdb; pdb.set_trace()
在文档测试中有提示,但我不想插入这样的行。
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 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不认为你可以在字符串中设置断点。
doctest
是一个用于自动化测试的模块。如果您需要调试文档测试代码,为什么不正常运行它并验证输出,然后在知道它有效后将其放入文档字符串中?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?