I'm having a problem running django doctests with django-nose. Unit tests added to a /tests directory are running fine, but doctests are not.
I am trying to run doctests on 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 a basic doctest to try to get this to work, e.g.:
"""
>>> 1+1 == 2
True
"""
This is in my models.py. I've tried other doctests actually testing the code and still don't see any tests run. When I run with --verbosity 3, I see one line that may be the issue:
nose.selector: INFO: <models.py path> is executable; skipped
I couldn't find any more info on what this means though.
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 after south in INSTALLED_APPS as specified in the django-nose documentation. I'm using the --with-doctest argument as suggested here: Nose not running Django doctests, and have updated my django-nose to the latest as suggested here: Why isn't django-nose running the doctests in my models?
These are the versions I am using:
django 1.3
python 2.7.1
django-nose 0.1.3
nose 1.1.2
I feel like I'm missing some basic setup here. Let me know if any other info is needed. Any help is appreciated, thanks!
I realize that the OP specified 1.3, but since this answer comes up in a search for 'django doctests do not run' here's my answer for 1.6 from one of the answers in Django doctests in views.py. in this version of Django doctests are not automatically included, so in $APP/tests.py you need:
import doctest
def load_tests(loader, tests, ignore):
tests.addTests(doctest.DocTestSuite())
return tests
[this only finds the doctests in tests.py itself; to have it run doctests on other modules, say myapp/models.py, you need to from myapp import models
and tests.addTests(doctest.DocTestSuite(models))
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With