我开始了一个致命的简单 django 项目来尝试 django 的 doctest:
# models.py
"""
>>> 1+1 == 2
True
"""
并运行python manage.py test
获取:
Creating test database for alias 'default'...
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
Destroying test database for alias 'default'...
和跑步一样python manage.py play
。
我通过设置解决了这个问题:
INSTALLED_APPS = (
...
'django_nose',
)
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
NOSE_ARGS = ['--with-doctest']
我的问题是我的设置是否需要?因为文档中没有提到它:https ://docs.djangoproject.com/en/1.4/topics/testing/
我的django版本是1.7,是1.4和1.7的区别吗?