我在 Django 中不断收到单元测试错误,我不明白。
完整的错误信息:
Creating test database for alias 'default'...
.................................................................................E.......................................................................................................................................................................................................................................................................s........................................................................
======================================================================
ERROR: test_site_profile_not_available (django.contrib.auth.tests.models.ProfileTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/tests/models.py", line 29, in test_site_profile_not_available
del settings.AUTH_PROFILE_MODULE
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 215, in __delattr__
delattr(self._wrapped, name)
AttributeError: AUTH_PROFILE_MODULE
----------------------------------------------------------------------
Ran 418 tests in 26.548s
FAILED (errors=1, skipped=1)
Destroying test database for alias 'default'...
更新:
我已插入完整的错误消息,甚至将测试减少到最低限度:
class ContactModelTest(TestCase):
def setUp(self):
ctype = ContactType.objects.create()
ctype.contact_type= "test1"
ctype.save()
def test_get_contacts_user1(self):
ctype = ContactType.objects.all()
为什么会这样?