Using coverage, how do I test this line?

流过昼夜 提交于 2019-12-03 06:10:32

The coverage report shows that the method is being called (line 80 is green). But it also shows that it was never defined (line 75 is red).

This is a classic problem of starting coverage too late. The simplest way to fix this is to use coverage to run your test runner, instead of using the test runner to run coverage:

$ coverage run -m nose --verbosity=1

UPDATED: to use with your original command:

$ coverage run manage.py test

but you'd want to uninstall the nose coverage plugin first.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!