适用于Visual Studio的Python工具上的Pytest [英] Pytest on Python Tools for visual studio

查看:244
本文介绍了适用于Visual Studio的Python工具上的Pytest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以在Visual Studio 2010上调试使用pytest库的python测试吗?我在Interpreter参数上添加了-m pytest,但是没有命中断点,我只能运行测试脚本而不进行调试.

Can debug python tests which are using pytest library on visual studio 2010 ? I added the -m pytest on the Interpreter arguments but the breakpoints are not hit, I can only run the test script without debugging it.

推荐答案

Pytest建议创建一个独立的启动脚本.

Pytest recommends creating a standalone startup script.

if __name__ == '__main__':
    import pytest
    pytest.main()

这就是我的工作,PTVS调试对我有用.

This is what I do and PTVS debugging works for me.

这篇关于适用于Visual Studio的Python工具上的Pytest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆