【发布时间】:2014-11-07 13:37:31
【问题描述】:
当我使用 Django 1.7.1 进行测试时,它会引发下一个警告:
/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)
我也尝试在 settings.py 文件中添加这一行:
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
但仍然抛出警告。
我从我的测试模型文件中记下代码:
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__())
我已阅读 Django 网页中的文档:https://docs.djangoproject.com/en/1.7/topics/testing/overview/,但仍无法找到解决方案。
我正在使用 Django-nose。
我该如何解决这个问题?
谢谢
【问题讨论】:
标签: python django django-testing django-nose