南部安装后Django测试的问题

时间:2011-07-26 03:27:47

标签: django django-south django-testing

安装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

有任何建议或想法吗?

非常感谢

1 个答案:

答案 0 :(得分:2)

问题是众所周知的。一些特殊的数据字段不是South complient,它包括来自django扩展的加密字段,这里是问题和补丁:https://github.com/django-extensions/django-extensions/pull/103

编辑:补丁已合并。它是主人,将在下一个版本。