Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Malcolm Tredinnick authored September 25, 2006
1  AUTHORS
@@ -154,6 +154,7 @@ answer newbie questions, and generally made Django that much better:
154 154
     Gary Wilson <gary.wilson@gmail.com>
155 155
     wojtek
156 156
     ye7cakf02@sneakemail.com
  157
+    ymasuda@ethercube.com
157 158
     Cheng Zhang
158 159
 
159 160
 A big THANK YOU goes to:
7  django/test/doctest.py
@@ -1319,13 +1319,16 @@ def __record_outcome(self, test, f, t):
1319 1319
     __LINECACHE_FILENAME_RE = re.compile(r'<doctest '
1320 1320
                                          r'(?P<name>[\w\.]+)'
1321 1321
                                          r'\[(?P<examplenum>\d+)\]>$')
1322  
-    def __patched_linecache_getlines(self, filename):
  1322
+    def __patched_linecache_getlines(self, filename, module_globals=None):
1323 1323
         m = self.__LINECACHE_FILENAME_RE.match(filename)
1324 1324
         if m and m.group('name') == self.test.name:
1325 1325
             example = self.test.examples[int(m.group('examplenum'))]
1326 1326
             return example.source.splitlines(True)
1327 1327
         else:
1328  
-            return self.save_linecache_getlines(filename)
  1328
+            if sys.version_info < (2, 5, 0):
  1329
+                return self.save_linecache_getlines(filename)
  1330
+            else:
  1331
+                return self.save_linecache_getlines(filename, module_globals)
1329 1332
 
1330 1333
     def run(self, test, compileflags=None, out=None, clear_globs=True):
1331 1334
         """

0 notes on commit 5b490bb

Please sign in to comment.
Something went wrong with that request. Please try again.