使用 Django 鼻子。我对我的 URL 进行了测试,但 URL 的覆盖率仍然为 0%,为什么?
python manage.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/')