pycharm - 无法在 pycharm 中使用 pytest 进行调试

标签 pycharm pytest

我不能调试 在 PyCharm 中使用 py.test。所有测试套件在“ Debug模式”下运行正常,但不会在断点处停止。

Debug Mode

我也有 py.test 作为默认的测试运行器。

也许这并不重要,但调试在我的 Django 服务器中可以正常工作。

有任何想法吗?

Configuration
picture of enable_breakpoints_and_the_mode_of_pycharm_is_debug

引用:

pycharm-enabling-disabling-and-removing-breakpoints

Run/Debug Configuration: py.test

最佳答案

如果您默认启用了覆盖(通常在 pytest.ini 上),则根本问题是调试不起作用。
要仅在 pycharm 上禁用,只需添加 --no-covAdditional ArgumentsRun/Debug Configurations .
更新 Templates -> Python tests -> pytest ,所以每个新的测试都会得到这个配置。
在此之后,删除您当前的调试设置并重新调试它。
enter image description herePycharm 2018.3.x (在 2020.x 中仍然有效)

关于pycharm - 无法在 pycharm 中使用 pytest 进行调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40718760/

相关文章:

python - 文档字符串中 PyCharm 中 Unresolved 属性引用问题

python - pytest localstack测试报错You必须指定区域

python - 如何使用 pytest 确认引发正确的异常

django - 模型实例 fixture 未保留在数据库中

python - "Desired Capabilities must be a dictionary"将 dict 传递到参数化方法时出错

MySQLdb._exceptions.ProgrammingError : (1064,“您的 SQL 语法有错误)

python - 由于 AttributeError : module 'PyQt5.QtGui' has no attribute 'QApplication' ,在 PyCharm 中导入 matplotlib.pyplot 失败

python - py.test : How to generate tests from fixtures

python - 在 pycharm 中使用标准输入

PyCharm 将目录标记为通过文件系统中的标志排除在外?