South安装后Django测试出现问题
安装 South 后,我的测试中开始出现一些错误。我尝试过 SKIP_SOUTH_TESTS=True 和 SOUTH_TESTS_MIGRATE = False,但没有运气。这是输出:
Creating test database for alias 'default'...
....................................................................................................................................................................................................................................................................................................................s...........................................................................EEEE.............
======================================================================
ERROR: testCharFieldCreate (django_extensions.tests.encrypted_fields.EncryptedFieldsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django_extensions/tests/encrypted_fields.py", line 31, in setUp
call_command('syncdb', verbosity=0)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/__init__.py", line 166, in call_command
return klass.execute(*args, **defaults)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/commands/syncdb.py", line 109, in handle_noargs
emit_post_sync_signal(created_models, verbosity, interactive, db)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/sql.py", line 190, in emit_post_sync_signal
interactive=interactive, db=db)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/dispatch/dispatcher.py", line 172, in send
response = receiver(signal=self, sender=sender, **named)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/auth/management/__init__.py", line 30, in create_permissions
ctype = ContentType.objects.get_for_model(klass)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/contenttypes/models.py", line 40, in get_for_model
self._add_to_cache(self.db, ct)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/contenttypes/models.py", line 70, in _add_to_cache
key = (model._meta.app_label, model._meta.object_name.lower())
AttributeError: 'NoneType' object has no attribute '_meta'
======================================================================
ERROR: testCharFieldRead (django_extensions.tests.encrypted_fields.EncryptedFieldsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django_extensions/tests/encrypted_fields.py", line 31, in setUp
call_command('syncdb', verbosity=0)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/__init__.py", line 166, in call_command
return klass.execute(*args, **defaults)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/commands/syncdb.py", line 109, in handle_noargs
emit_post_sync_signal(created_models, verbosity, interactive, db)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/sql.py", line 190, in emit_post_sync_signal
interactive=interactive, db=db)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/dispatch/dispatcher.py", line 172, in send
response = receiver(signal=self, sender=sender, **named)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/auth/management/__init__.py", line 30, in create_permissions
ctype = ContentType.objects.get_for_model(klass)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/contenttypes/models.py", line 40, in get_for_model
self._add_to_cache(self.db, ct)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/contenttypes/models.py", line 70, in _add_to_cache
key = (model._meta.app_label, model._meta.object_name.lower())
AttributeError: 'NoneType' object has no attribute '_meta'
======================================================================
ERROR: testTextFieldCreate (django_extensions.tests.encrypted_fields.EncryptedFieldsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django_extensions/tests/encrypted_fields.py", line 31, in setUp
call_command('syncdb', verbosity=0)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/__init__.py", line 166, in call_command
return klass.execute(*args, **defaults)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/commands/syncdb.py", line 109, in handle_noargs
emit_post_sync_signal(created_models, verbosity, interactive, db)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/sql.py", line 190, in emit_post_sync_signal
interactive=interactive, db=db)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/dispatch/dispatcher.py", line 172, in send
response = receiver(signal=self, sender=sender, **named)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/auth/management/__init__.py", line 30, in create_permissions
ctype = ContentType.objects.get_for_model(klass)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/contenttypes/models.py", line 40, in get_for_model
self._add_to_cache(self.db, ct)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/contenttypes/models.py", line 70, in _add_to_cache
key = (model._meta.app_label, model._meta.object_name.lower())
AttributeError: 'NoneType' object has no attribute '_meta'
======================================================================
ERROR: testTextFieldRead (django_extensions.tests.encrypted_fields.EncryptedFieldsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django_extensions/tests/encrypted_fields.py", line 31, in setUp
call_command('syncdb', verbosity=0)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/__init__.py", line 166, in call_command
return klass.execute(*args, **defaults)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/commands/syncdb.py", line 109, in handle_noargs
emit_post_sync_signal(created_models, verbosity, interactive, db)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/sql.py", line 190, in emit_post_sync_signal
interactive=interactive, db=db)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/dispatch/dispatcher.py", line 172, in send
response = receiver(signal=self, sender=sender, **named)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/auth/management/__init__.py", line 30, in create_permissions
ctype = ContentType.objects.get_for_model(klass)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/contenttypes/models.py", line 40, in get_for_model
self._add_to_cache(self.db, ct)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/contenttypes/models.py", line 70, in _add_to_cache
key = (model._meta.app_label, model._meta.object_name.lower())
AttributeError: 'NoneType' object has no attribute '_meta'
----------------------------------------------------------------------
Ran 401 tests in 16.147s
有什么建议或想法吗?
非常感谢
After installing South, some errors started happening in my tests. I've tried SKIP_SOUTH_TESTS=True and SOUTH_TESTS_MIGRATE = False, but with no luck. Here is the output:
Creating test database for alias 'default'...
....................................................................................................................................................................................................................................................................................................................s...........................................................................EEEE.............
======================================================================
ERROR: testCharFieldCreate (django_extensions.tests.encrypted_fields.EncryptedFieldsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django_extensions/tests/encrypted_fields.py", line 31, in setUp
call_command('syncdb', verbosity=0)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/__init__.py", line 166, in call_command
return klass.execute(*args, **defaults)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/commands/syncdb.py", line 109, in handle_noargs
emit_post_sync_signal(created_models, verbosity, interactive, db)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/sql.py", line 190, in emit_post_sync_signal
interactive=interactive, db=db)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/dispatch/dispatcher.py", line 172, in send
response = receiver(signal=self, sender=sender, **named)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/auth/management/__init__.py", line 30, in create_permissions
ctype = ContentType.objects.get_for_model(klass)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/contenttypes/models.py", line 40, in get_for_model
self._add_to_cache(self.db, ct)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/contenttypes/models.py", line 70, in _add_to_cache
key = (model._meta.app_label, model._meta.object_name.lower())
AttributeError: 'NoneType' object has no attribute '_meta'
======================================================================
ERROR: testCharFieldRead (django_extensions.tests.encrypted_fields.EncryptedFieldsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django_extensions/tests/encrypted_fields.py", line 31, in setUp
call_command('syncdb', verbosity=0)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/__init__.py", line 166, in call_command
return klass.execute(*args, **defaults)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/commands/syncdb.py", line 109, in handle_noargs
emit_post_sync_signal(created_models, verbosity, interactive, db)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/sql.py", line 190, in emit_post_sync_signal
interactive=interactive, db=db)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/dispatch/dispatcher.py", line 172, in send
response = receiver(signal=self, sender=sender, **named)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/auth/management/__init__.py", line 30, in create_permissions
ctype = ContentType.objects.get_for_model(klass)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/contenttypes/models.py", line 40, in get_for_model
self._add_to_cache(self.db, ct)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/contenttypes/models.py", line 70, in _add_to_cache
key = (model._meta.app_label, model._meta.object_name.lower())
AttributeError: 'NoneType' object has no attribute '_meta'
======================================================================
ERROR: testTextFieldCreate (django_extensions.tests.encrypted_fields.EncryptedFieldsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django_extensions/tests/encrypted_fields.py", line 31, in setUp
call_command('syncdb', verbosity=0)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/__init__.py", line 166, in call_command
return klass.execute(*args, **defaults)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/commands/syncdb.py", line 109, in handle_noargs
emit_post_sync_signal(created_models, verbosity, interactive, db)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/sql.py", line 190, in emit_post_sync_signal
interactive=interactive, db=db)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/dispatch/dispatcher.py", line 172, in send
response = receiver(signal=self, sender=sender, **named)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/auth/management/__init__.py", line 30, in create_permissions
ctype = ContentType.objects.get_for_model(klass)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/contenttypes/models.py", line 40, in get_for_model
self._add_to_cache(self.db, ct)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/contenttypes/models.py", line 70, in _add_to_cache
key = (model._meta.app_label, model._meta.object_name.lower())
AttributeError: 'NoneType' object has no attribute '_meta'
======================================================================
ERROR: testTextFieldRead (django_extensions.tests.encrypted_fields.EncryptedFieldsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django_extensions/tests/encrypted_fields.py", line 31, in setUp
call_command('syncdb', verbosity=0)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/__init__.py", line 166, in call_command
return klass.execute(*args, **defaults)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/commands/syncdb.py", line 109, in handle_noargs
emit_post_sync_signal(created_models, verbosity, interactive, db)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/core/management/sql.py", line 190, in emit_post_sync_signal
interactive=interactive, db=db)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/dispatch/dispatcher.py", line 172, in send
response = receiver(signal=self, sender=sender, **named)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/auth/management/__init__.py", line 30, in create_permissions
ctype = ContentType.objects.get_for_model(klass)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/contenttypes/models.py", line 40, in get_for_model
self._add_to_cache(self.db, ct)
File "/home/rodrigo/Workspace/.virtualenvs/nossodesconto_django_fork/lib/python2.6/site-packages/django/contrib/contenttypes/models.py", line 70, in _add_to_cache
key = (model._meta.app_label, model._meta.object_name.lower())
AttributeError: 'NoneType' object has no attribute '_meta'
----------------------------------------------------------------------
Ran 401 tests in 16.147s
Any suggestions or ideas?
Many thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是已知的。一些特殊的数据字段不兼容 South,它包括来自 django 扩展的加密字段,这里是问题和补丁: https://github.com/django-extensions/django-extensions/pull/103
编辑:补丁已合并。它在 master 中,并将在下一个版本中出现。
The problem is known. Some special data fields are not South complient, it include the encrypted fields from django extension, here the issue and the patch: https://github.com/django-extensions/django-extensions/pull/103
edit: the patch has been merged. it's in master and will be in next release.