Here's how to run all doctests in a directory:
$ manage.py shell
import re
import os
import string
from doctest import testmod
django_dir=r'/path/to/source/'
trim=len(django_dir)
dots=string.maketrans(r'\/','..')
init=re.compile(r'\.?\.__init__')
skip=('django.bin.make-messages','django.contrib.auth.handlers.modpython',
'django.core.cache.backends.memcached','django.db.backends.ado_mssql.base')
def test_files(arg,dir,files):
for f in files:
if f.endswith('.py'):
mod_name=init.sub('','.'.join(('django',dir[trim:].translate(dots),f[:-3])))
if mod_name in skip: continue
print mod_name, testmod(__import__(mod_name, globals(), locals(),
['']))
os.path.walk(django_dir,test_files,None)
====
change django_dir to wherever you keep your django source
probably should start with empty list of mods to skip when you run it,
depends on your install
probably should be in a wiki somewhere- trivial to make non-Django
specific
probably should check that there's a '>>>' somewhere in the file, since
many files have no doctests, and running import/testmod on them wastes
much time in toto
probably should improve it umpteen other ways as well...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---