如何使用coverage.py在Django-Python中实现Ruby-Rails这样的覆盖率报告?

时间:2023-01-11 16:55:15

We do coverage reports with the famous and possible the only solution in python world i.e. coverage.py

我们使用著名的并且可能是python世界中唯一的解决方案进行报道,例如coverage.py

Now, What we acheive with coverage.py is this : 如何使用coverage.py在Django-Python中实现Ruby-Rails这样的覆盖率报告?

现在,我们对保险范围的了解。py是这样的:

Where as what we could achieve with ruby-rails is : 如何使用coverage.py在Django-Python中实现Ruby-Rails这样的覆盖率报告?

我们可以用ruby-rails实现的是:

So, my question is how do you get more detailed coverage reports with coverage.py ?

所以,我的问题是,如何获得更详细的覆盖报告。py吗?

[ Or any other tool in the python django world ]

[或python django世界中的任何其他工具]

Note:

注意:

  • coverage run manage.py test --settings=project.test_settings
  • 保险经营管理。py——设置= project.test_settings测试
  • Generate the report by coverage html
  • 通过覆盖率html生成报告
  • Should / Can I pass in extra parameters to coverage while generating report ?
  • 我是否可以在生成报告时,将额外的参数传递给覆盖率?

1 个解决方案

#1


2  

1) A search box seems useful, no one has ever suggested it before!

1)搜索框似乎很有用,以前从来没有人提出过!

2) Conditional coverage: coverage.py has a --branch switch that enables branch coverage, is this what you are looking for?

2)条件覆盖:覆盖。py有一个分支开关,支持分支覆盖,这是你要找的吗?

3) Hits/line: is this how many times each line was executed? I've never seen it aggregated like this. I don't understand how I would use that statistic in my own work. Can you help me understand why people want to know the averaged hits/line?

3) hit /line:这是每行执行多少次吗?我从未见过它像这样聚合。我不明白如何在我自己的工作中使用这个数据。你能帮我理解为什么人们想知道平均点击量/行数吗?

#1


2  

1) A search box seems useful, no one has ever suggested it before!

1)搜索框似乎很有用,以前从来没有人提出过!

2) Conditional coverage: coverage.py has a --branch switch that enables branch coverage, is this what you are looking for?

2)条件覆盖:覆盖。py有一个分支开关,支持分支覆盖,这是你要找的吗?

3) Hits/line: is this how many times each line was executed? I've never seen it aggregated like this. I don't understand how I would use that statistic in my own work. Can you help me understand why people want to know the averaged hits/line?

3) hit /line:这是每行执行多少次吗?我从未见过它像这样聚合。我不明白如何在我自己的工作中使用这个数据。你能帮我理解为什么人们想知道平均点击量/行数吗?