Nose 未运行 Django 文档测试
类似于这个问题。但是,就我而言,我的模型的 doctest
都没有运行。
我正在使用 Django 1.3 beta 1。
# settings.py
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
INSTALLED_APPS = (
##...a bunch of django apps
'django_nose',
'south',
'my_project.my_app',
)
我的模型的一个文档测试:
class ItemType(models.Model):
'''
>>> temType.objects.all().count() == 0
True
'''
name = models.CharField(max_length=32)
def __unicode__(self):
return self.name
应该因 initial_data
固定装置而失败,但为了以防万一,我尝试了以下操作:
class ItemType(models.Model):
'''
>>> ItemType.objects.all().count() == -1
True
'''
name = models.CharField(max_length=32)
def __unicode__(self):
return self.name
我尝试运行以下内容:
./manage.py test --with-doctest my_app
使用 Django 测试运行程序,我只需为我的测试键入以下内容要处理的文档测试:
./manage.py test my_app
有什么建议吗?
Similar to this question. However, in my case, none of my models' doctest
are running.
I'm using Django 1.3 beta 1.
# settings.py
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
INSTALLED_APPS = (
##...a bunch of django apps
'django_nose',
'south',
'my_project.my_app',
)
One of my model's doctest:
class ItemType(models.Model):
'''
>>> temType.objects.all().count() == 0
True
'''
name = models.CharField(max_length=32)
def __unicode__(self):
return self.name
Should fail because of initial_data
fixture but just in case, I tried it with the following:
class ItemType(models.Model):
'''
>>> ItemType.objects.all().count() == -1
True
'''
name = models.CharField(max_length=32)
def __unicode__(self):
return self.name
I tried running the following:
./manage.py test --with-doctest my_app
With the Django test runner, I just type the following for my doctests to be processed:
./manage.py test my_app
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在您的设置中,只需包含此设置:
请参阅 django-nose 文档更多选择
In your settings, just include this setting:
See django-nose documentation to more options
现在可能为时已晚,但是您可以使用更高的
--verbosity
运行测试吗?如果您发现消息称文件由于可执行而被跳过,请尝试将
--exe
添加到 NOSE_ARGS 或chmod -x the_file.py
。Probably too late by now but, can you run your tests with higher
--verbosity
?If you find messages saying files are being skipped due to being executable, try adding
--exe
to your NOSE_ARGS orchmod -x the_file.py
.