Python覆盖范围突然掉落
我正在使用Pyqt5创作用Python编写的GUI,并且正在为Sonarqube准备报道报告。
覆盖范围最初为43%。然后在我更改主文件后突然下降,称为app.py
。我所做的就是添加以下内容:
if __name__ == "__main__":
main()
我添加了此内容,因为没有它,它会在导入app.py
时显示GUI。 main()
简单地实例化应用程序,还包含指令显示主窗口。随着上述添加,覆盖范围降至14%。如果我删除上述内容,则覆盖范围将返回到43%。有什么想法为什么添加这种微小的变化后,覆盖范围会突然下降,以及我如何阻止它掉落太多?
版本:
- Python 3.10.2
- Coverage.Py,版本6.3.3,带有C扩展
- Pyqt5 5.15.4
I'm working on a GUI written in Python using PyQt5, and I'm preparing the coverage report for SonarQube.
The coverage was initially 43%. Then it suddenly dropped after I changed the main file, called app.py
. All I did was add the following:
if __name__ == "__main__":
main()
I added this because without it, it would display the GUI when importing app.py
.
The main()
simply instantiates the application, and also contains instructions to show the main window. With the above addition, the coverage drops to 14%. If I remove the above, the coverage goes right back to 43%. Any ideas why the coverage would suddenly drop significantly upon adding this tiny change, and how I could prevent it from dropping this much?
Versions:
- Python 3.10.2
- Coverage.py, version 6.3.3 with C extension
- PyQt5 5.15.4
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论