Django doctests not starting

I have a problem with django doctests with django nose. Unit tests added to the / tests directory work fine, but the exercises are not.

I am trying to run doctrines in my season module:

python manage.py test season 

and get this output:

 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'... 

I'm just trying to do a basic lesson to try to get this to work, for example:

  """ >>> 1+1 == 2 True """ 

This is in my models.py. I have tried other doctrines that actually test the code, and still don't see any tests. When I run with --verbosity 3, I see one line, which may be the problem:

 nose.selector: INFO: <models.py path> is executable; skipped 

I could no longer find information on what this means.

Relevant snippets from settings.py:

 INSTALLED_APPS = ( 'south', 'django_nose', 'season', ) # Django-nose configuration TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' NOSE_ARGS = ['--with-doctest'] 

django_nose is located after the south at INSTALLED_APPS, as indicated in the django-nose documentation. I use the --with-doctest argument suggested here: Nose doesn't launch Django boards , and updated my django nose to the last, as suggested here: Why doesn't the django nose launch doctrines in my models?

These are the versions I use:
django 1.3
python 2.7.1
django-nose 0.1.3
nose 1.1.2

I feel like I am missing a basic setup here. Let me know if any other information is needed. Any help is appreciated, thanks!

+4
source share
3 answers

The details message tells you that your models.py file is ignored because it is executable. This means what you need to do:

 chmod -x models.py 

Unless you have a specific reason for this file to be installed as executable, in this case adding --exe to your NOSE_ARGS should be sufficient.

+2
source

I understand that OP asked 1.3, but since this answer appears in the search for “django doctests does not start” here, my answer is for 1.6 from one of the answers in Django doctests in views.py . in this version, Django doctrines are not automatically included, so in $ APP / tests.py you need to:

 import doctest def load_tests(loader, tests, ignore): tests.addTests(doctest.DocTestSuite()) return tests 

[this finds only doctrines in test.py itself; so that it runs doctrines on other modules, say myapp / models.py, you need from myapp import models and tests.addTests(doctest.DocTestSuite(models)) ]

+2
source

nosetests --verbosity 1 season --with-doctest

Usage: manage.py test [options] [appname ...]

Maybe you just need to move the season to finish then.

+1
source

All Articles