Nose not running Django doctests

随声附和 提交于 2019-12-10 17:37:09

问题


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?


回答1:


In your settings, just include this setting:

NOSE_ARGS = ['--with-doctest', other_nose_args]

See django-nose documentation to more options




回答2:


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.



来源:https://stackoverflow.com/questions/4588305/nose-not-running-django-doctests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!