Django 1.7 – How do I suppress "(1_6.W001) Some project unittests may not execute as expected."?

Question:

I have a Django application that has parts originally written in Django 1.2, and the application has been upgraded all the way up to 1.7. After upgrading to 1.7, I’m getting the following warning from python manage.py check:

System check identified some issues:

WARNINGS:
?: (1_6.W001) Some project unittests may not execute as expected.
    HINT: Django 1.6 introduced a new default test runner. It looks like this project was generated using Django 1.5 or earlier. You should ensure your tests are all running & behaving as expected. See https://docs.djangoproject.com/en/dev/releases/1.6/#new-test-runner for more information.

The URL mentioned in the error message does detail the changes that have been made, but it does not give any hint as to why this warning is triggered or how to suppress it. Even though the warning message references Django 1.6, it only started appearing after upgrading to Django 1.7

I have checked that the same number of unit tests is being run under Django 1.7 as was being run under Django 1.6.1.

For those interested, the application in question is an event management system called Kompassi that can be found on Github.

Asked By: Santtu Pajukanta

||

Answers:

You can silence individual system check warnings with the SILENCED_SYSTEM_CHECKS setting.

Regarding your other question about how to find the reasons why this warning was triggered, the only place I could find was by looking at the source code.

Answered By: Vinod Kurup

Found a blog post that reveals explicitly specifying

TEST_RUNNER = 'django.test.runner.DiscoverRunner'

in settings.py will stop this warning from occurring.

Answered By: Santtu Pajukanta

It looks like the developers have decided to remove this warning:

https://code.djangoproject.com/ticket/23469

Answered By: Arklon

See https://github.com/django/django/blob/1.7/django/core/checks/compatibility/django_1_6_0.py#L42 for the list of things it checks that gives you this error.

Answered By: xeor

If everything’s OK with your tests, you can simply turn the warning off by doing one (or all) of these steps:

  1. Remove SITE_ID from your settings if you don’t use sites framework anymore.

  2. Add BASE_DIR variable to your settings.

  3. Remove MANAGERS list form your setting if you don’t use it.

  4. Remove XFrameOptionsMiddleware middleware in settings. (It’s enabled by default in Django 1.6+ anyway)

  5. Remove custom TEMPLATE_LOADERS or ADMINS if you don’t need them (you usually do, so don’t do it unless you know what you’re doing).

Those are two things current heuristics (Django 1.7.3) checks in order to detect if your project was generated by Django <1.6.

Answered By: Ivan Anishchuk