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.
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.
Found a blog post that reveals explicitly specifying
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
in settings.py
will stop this warning from occurring.
It looks like the developers have decided to remove this warning:
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.
If everything’s OK with your tests, you can simply turn the warning off by doing one (or all) of these steps:
-
Remove SITE_ID
from your settings if you don’t use sites framework anymore.
-
Add BASE_DIR
variable to your settings.
-
Remove MANAGERS
list form your setting if you don’t use it.
-
Remove XFrameOptionsMiddleware
middleware in settings. (It’s enabled by default in Django 1.6+ anyway)
-
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.
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.
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.
Found a blog post that reveals explicitly specifying
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
in settings.py
will stop this warning from occurring.
It looks like the developers have decided to remove this warning:
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.
If everything’s OK with your tests, you can simply turn the warning off by doing one (or all) of these steps:
-
Remove
SITE_ID
from your settings if you don’t use sites framework anymore. -
Add
BASE_DIR
variable to your settings. -
Remove
MANAGERS
list form your setting if you don’t use it. -
Remove
XFrameOptionsMiddleware
middleware in settings. (It’s enabled by default in Django 1.6+ anyway) -
Remove custom
TEMPLATE_LOADERS
orADMINS
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.