Search code examples
pythondjangounit-testingnosedjango-south

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


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?


Solution

  • 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 :)