如何让PyCharm终端中pytest输出的文件路径可点击?
问题:PyCharm终端中pytest输出的文件路径如何设置为可点击状态
在PyCharm终端执行pytest --cov命令时,得到如下输出:
FAIL Required test coverage of 100.0% not reached. Total coverage: 55.03% =========================================================================================================================================== short test summary info =========================================================================================================================================== FAILED test/fhg_isi/plotting/test_matplotlib.py::test_create_graph - TypeError: create_graph() missing 1 required positional argument: 'template' FAILED test/fhg_isi/plotting/test_matplotlib.py::test_create_graph_having_subplots - TypeError: create_graph_having_subplots() missing 1 required positional argument: 'template'
希望让输出中的文件路径变为可点击状态,能快速在PyCharm中打开对应文件,询问是否需要特定覆盖率报告类型或调整PyCharm终端设置。
解决方法
调整PyCharm终端设置即可,无需修改覆盖率报告类型:
- 打开PyCharm的
Settings(Windows/Linux按Ctrl+Alt+S,Mac按Cmd+,) - 导航到
Tools > Terminal - 找到
Shell integration选项,确保勾选**"Enable shell integration"** - 关闭当前终端窗口后重新打开
- 打开PyCharm的
如果上述设置无效,可指定pytest输出格式:
执行命令时添加--tb=short参数,让输出格式更贴合PyCharm的路径识别规则:pytest --cov --tb=short你的输出中文件路径格式本身已符合要求,开启shell集成后即可触发点击跳转。
内容的提问来源于stack exchange,提问作者Stefan
相关产品推荐
相关产品推荐

