usage# 安装pip install coverage# 清楚缓存文件 .coveragecoverage erase# 执行测试coverage run manage.py test# 生成测试报告coverage report# 生成html报告coverage html 配置测试代码范围.coveragerc: [run]branch = Truesource = .omit = manage.py venv/* models.py[report]show_missing = Trueskip_covered = True test democlass XXXTest(TestCase): def test_xxx(self): self.client.get(url) self.client.post(url, data={}, content_type='application/json')