【问题标题】:Debugging pytest post mortem exceptions in pycharm/pydev在 pycharm/pydev 中调试 pytest 事后异常
【发布时间】:2012-12-29 21:24:50
【问题描述】:
【问题讨论】:
标签:
python
unit-testing
debugging
pycharm
pytest
【解决方案1】:
你在使用pytest-pycharm 插件吗?看起来它对我有用。创建 virtualenv,pip install pytest pytest-pycharm,在 PyCharm Edit configuration -> Python Interpreter 上使用这个 virtualenv,然后使用 Debug ... 运行示例:
import pytest
def test_me():
assert None
if __name__ == '__main__':
pytest.main(args=[__file__])
PyCharm 调试器在assert None 点停止,(<class '_pytest.assertion.reinterpret.AssertionError'>, AssertionError(u'assert None',), None)
编辑
将Preferences > Tools > Python Integration Tools > Default test runner 设置为py.test。然后Run > Debug 'py.test in test_me.py'