Similar to this question. However, in my case, none of my models' doctest
are running.
I'm using Djang开发者_JAVA百科o 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?
In your settings, just include this setting:
NOSE_ARGS = ['--with-doctest', other_nose_args]
See django-nose documentation to more options
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 or chmod -x the_file.py
.
精彩评论