开发者

South django.db.utils.IntegrityError: django_content_type.name may not be NULL while running unit tests

开发者 https://www.devze.com 2023-01-23 10:01 出处:网络
I\'m getting this error django.db.utils.IntegrityError: django_content_type.name may not be NULL while running tests via nosetest.

I'm getting this error django.db.utils.IntegrityError: django_content_type.name may not be NULL while running tests via nosetest.

I've done everything as told in south tutorial - initial migration开发者_开发知识库, fake migration etc. Running site normally via runserver command works like charm, but while using test command - above error.

Also, In my development enviroment I'm using sqlite database and I'm using django-nose as test runner (at the very end of INSTALLED_APPS.

Any clues?


Ok - I've managed to solve the problem on my own.

Seems to me that there is a problem integrating south, nose and in-memory db which is created by the django test command.

All I had to do is to define TEST_NAME in my developement settings - like this:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'database.sqlite',
        'TEST_NAME': 'test_database.sqlite',
    }
}

That's it :)

0

精彩评论

暂无评论...
验证码 换一张
取 消