39

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.

Santtu Pajukanta
  • 1,371
  • 1
  • 12
  • 15
  • Did you follow the 2 points mentioned here? https://docs.djangoproject.com/en/dev/releases/1.6/#new-test-runner – karthikr Sep 16 '14 at 14:53
  • 1
    As I stated in the question, the same number of tests is being run, so this is a false positive. All my tests are placed in files called `tests.py` under the apps. I also checked if this was being triggered by `lippykala_test_app.py` in [one of the dependencies](https://github.com/kcsry/lippukala), but this was not the case. – Santtu Pajukanta Sep 16 '14 at 15:03
  • Here is a detailed explanation: http://daniel.hepper.net/blog/2014/04/fixing-1_6-w001-when-upgrading-from-django-1-5-to-1-7/ – Sam003 Jan 13 '15 at 15:28

5 Answers5

45

Found a blog post that reveals explicitly specifying

TEST_RUNNER = 'django.test.runner.DiscoverRunner'

in settings.py will stop this warning from occurring.

Santtu Pajukanta
  • 1,371
  • 1
  • 12
  • 15
  • 2
    This particular check tries to detect a certain configuration using some heuristics and unfortunately, it can result in some false-positives. This explicit tells the algorithm it was a django 1.7+ project. Thanks a lot. – bslima Nov 04 '14 at 16:41
  • Perfect solution (until as @Arklon points out, the devs can the warning in all it's colorful glory). – Joseph8th Dec 21 '14 at 21:06
10

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.

xeor
  • 5,301
  • 5
  • 36
  • 59
  • This is the most relevant answer because it explains the *reasons* for the problem and how you can solve it and not only the symptoms. – tjati Nov 29 '14 at 21:39
9

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.

Flimm
  • 136,138
  • 45
  • 251
  • 267
Vinod Kurup
  • 2,676
  • 1
  • 23
  • 18
9

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

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

Arklon
  • 106
  • 1
  • 1
    Update: was removed in [this commit](https://github.com/django/django/commit/7ae03204ac207bee78d668952744da853a3a732b) which is in Django 1.8 . – tutuDajuju Oct 30 '15 at 18:25
8

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.

Ivan Anishchuk
  • 487
  • 3
  • 16