mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Fixed #2771 -- Tweaked Django's doctest module so that it also works with
Python 2.5. Thanks, ymasuda. git-svn-id: http://code.djangoproject.com/svn/django/trunk@3819 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
b4e5a96ccc
commit
5b490bba93
1
AUTHORS
1
AUTHORS
@ -154,6 +154,7 @@ answer newbie questions, and generally made Django that much better:
|
||||
Gary Wilson <gary.wilson@gmail.com>
|
||||
wojtek
|
||||
ye7cakf02@sneakemail.com
|
||||
ymasuda@ethercube.com
|
||||
Cheng Zhang
|
||||
|
||||
A big THANK YOU goes to:
|
||||
|
@ -1319,13 +1319,16 @@ class DocTestRunner:
|
||||
__LINECACHE_FILENAME_RE = re.compile(r'<doctest '
|
||||
r'(?P<name>[\w\.]+)'
|
||||
r'\[(?P<examplenum>\d+)\]>$')
|
||||
def __patched_linecache_getlines(self, filename):
|
||||
def __patched_linecache_getlines(self, filename, module_globals=None):
|
||||
m = self.__LINECACHE_FILENAME_RE.match(filename)
|
||||
if m and m.group('name') == self.test.name:
|
||||
example = self.test.examples[int(m.group('examplenum'))]
|
||||
return example.source.splitlines(True)
|
||||
else:
|
||||
return self.save_linecache_getlines(filename)
|
||||
if sys.version_info < (2, 5, 0):
|
||||
return self.save_linecache_getlines(filename)
|
||||
else:
|
||||
return self.save_linecache_getlines(filename, module_globals)
|
||||
|
||||
def run(self, test, compileflags=None, out=None, clear_globs=True):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user