Search code examples
pythondjangodjango-testingdjango-nose

Testing in Django 1.7 throws warning: RemovedInDjango18Warning


When I do my tests with Django 1.7.1 it throws the next warning:

/usr/local/lib/python2.7/dist-packages/django/test/_doctest.py:59:
RemovedInDjango18Warning: The django.test._doctest module is deprecated;
use the doctest module from the Python standard library instead.
RemovedInDjango18Warning)

I also tried adding in the settings.py file this line:

TEST_RUNNER = 'django.test.runner.DiscoverRunner'

But still throws the warning.

I write down the code from my test model file:

from django.test import TestCase
from myproject import tests, models


class TestModels(TestCase):

    def test_rol(self):
        rol = tests.create_rol()
        rol.save()

        self.assertTrue(isinstance(rol, models.Rol))
        self.assertEqual(rol.name, rol.__unicode__())

I have read the docs from the Django Web page: https://docs.djangoproject.com/en/1.7/topics/testing/overview/ but still can't get a solution.

I am using Django-nose.

How can I solve this?

Thanks


Solution

  • This is a problem in the django-nose package (see GitHub issue #149). It has been fixed in master, but there is no PyPI release for it yet. For now, if you don't want to see the warning, you can point your requirements.txt file to the fixed version:

    -e git://github.com/django-nose/django-nose.git@154b663097e8f3131fe5d1cdd8a8df2e388450ac#egg=django_nose
    

    ... instead of ...

    django-nose==1.2
    

    Update: django-nose 1.3 has been released and contains this fix.