coverage.py Inforterror:没有名为Coverage.cmdline的模块

发布于 2025-01-21 22:54:10 字数 646 浏览 1 评论 0原文

我定期使用覆盖范围。py模块,但是每次我不使用它超过一年,我都会忘记如何使用它,并且需要大量时间来弄清楚如何使用它,因为发布了的说明https://coverage.readthedocs.io/en/6.3.2/不对现实无关,也不起作用。我上次写下说明时,尽管如此,我仍然无法正常工作。我过去使用过的说明是:

coverage-3.8 run -m [module without .py] [args]
coverage-3.8 html -i

现在,经过一些反复试验后,我必须使用:

Python -M覆盖范围运行[带.py的模块] [args] [args] [args

]

coverage html -i

我得到的

File "/usr/local/bin/coverage", line 7, in <module>
    from coverage.cmdline import main
ImportError: No module named coverage.cmdline

我过去已经能够生成HTML报告,它一直是简单的命令行函数,但我不知道为什么现在不起作用。

I use the coverage.py module periodically but every time I don't use it for more than a year I forget how to use it and it takes enormous amounts of time to figure out how to use it since the instructions posted at https://coverage.readthedocs.io/en/6.3.2/have no bearing on reality and do not work. The last time I wrote the instructions down but inspite of that I still cannot get it to work. The instructions that I used to use and that worked were:

coverage-3.8 run -m [module without .py] [args]
coverage-3.8 html -i

Now after some trial and error I have to use:

python -m coverage run [module with .py] [args]

That works but now when I try to generate the html report with

coverage html -i

I get

File "/usr/local/bin/coverage", line 7, in <module>
    from coverage.cmdline import main
ImportError: No module named coverage.cmdline

I have been able to generate the html report in the past and it has always been a simply command line function but I don't know why it doesn't work now.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏至、离别 2025-01-28 22:54:10

实际上,

coverage-3.8 run -m [module without .py] [args]
coverage-3.8 html -i

是有效的命令,将返回所需的结果。我决定不删除该帖子,以防其他人在coverage.py上有类似的问题。

Actually,

coverage-3.8 run -m [module without .py] [args]
coverage-3.8 html -i

are valid commands and will return the desired results. I decided not to delete the post just in case anyone else has similar problems with coverage.py.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文