summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2006-09-25 02:33:28 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2006-09-25 02:33:28 +0000
commit5b490bba93d03edc58f0903d5ebb75f7b0f44784 (patch)
treec00c46869dceb80b0280a27c73f61ef416c0e974
parentb4e5a96ccc6aeb0cc4761865d3ea3221d3665e72 (diff)
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
-rw-r--r--AUTHORS1
-rw-r--r--django/test/doctest.py7
2 files changed, 6 insertions, 2 deletions
diff --git a/AUTHORS b/AUTHORS
index 215f396b2a..3c2542cb0d 100644
--- a/AUTHORS
+++ b/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:
diff --git a/django/test/doctest.py b/django/test/doctest.py
index d600d15e52..3b364f0a75 100644
--- a/django/test/doctest.py
+++ b/django/test/doctest.py
@@ -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):
"""