使用Django Nose。我已经为我的URL编写了测试,但是覆盖率仍然显示URL的0%,为什么?
python manage.py test profiles
这是我的覆盖率结果:
这是我的URL测试之一... url_tests.py
这是我的覆盖率结果:
Name Stmts Miss Cover Missing
----------------------------------------------------------------
profiles 0 0 100%
profiles.migrations 0 0 100%
profiles.migrations.0001_initial 6 0 100%
profiles.models 0 0 100%
profiles.urls 4 4 0% 1-9
----------------------------------------------------------------
TOTAL 10 4 60%
----------------------------------------------------------------
这是我的URL测试之一... url_tests.py
import nose.tools as noz
from django.test import TestCase
from django.core.urlresolvers import resolve, reverse
class URLsTest(TestCase):
def test_user_list(self):
url = reverse('api_user_list', args=[])
noz.assert_equal(url, '/api/user/')