【发布时间】:2011-10-15 15:05:10
【问题描述】:
我在使用 django-nose 运行 django doctest 时遇到问题。添加到 /tests 目录的单元测试运行良好,但 doctests 却不行。
我正在尝试在我的“季节”模块上运行文档测试:
python manage.py test season
并得到这个输出:
nosetests --verbosity 1 season --with-doctest
Creating test database for alias 'default'...
----------------------------------------------------------------------
Ran 0 tests in 0.001s
OK
Destroying test database for alias 'default'...
我只是在尝试一个基本的 doctest 来尝试让它工作,例如:
"""
>>> 1+1 == 2
True
"""
这是在我的 models.py 中。我已经尝试过其他实际测试代码的文档测试,但仍然没有看到任何测试运行。当我使用 --verbosity 3 运行时,我看到一行可能是问题所在:
nose.selector: INFO: <models.py path> is executable; skipped
我找不到更多关于这意味着什么的信息。
settings.py中的相关sn-ps:
INSTALLED_APPS = (
'south',
'django_nose',
'season',
)
# Django-nose configuration
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
NOSE_ARGS = ['--with-doctest']
django_nose 在 INSTALLED_APPS 中位于南之后,如 django-nose 文档中所指定。我正在使用此处建议的 --with-doctest 参数:Nose not running Django doctests,并已将我的 django-nose 更新为此处建议的最新版本:Why isn't django-nose running the doctests in my models?
这些是我正在使用的版本:
django 1.3
python 2.7.1
django-nose 0.1.3
鼻子 1.1.2
我觉得我在这里缺少一些基本设置。让我知道是否需要任何其他信息。任何帮助表示赞赏,谢谢!
【问题讨论】:
标签: python django testing nose doctest