Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit 5b490bba93d03edc58f0903d5ebb75f7b0f44784 1 parent b4e5a96
@malcolmt malcolmt authored
Showing with 6 additions and 2 deletions.
  1. +1 −0  AUTHORS
  2. +5 −2 django/test/doctest.py
View
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:
View
7 django/test/doctest.py
@@ -1319,13 +1319,16 @@ def __record_outcome(self, test, f, t):
__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):
"""
Please sign in to comment.
Something went wrong with that request. Please try again.