summaryrefslogtreecommitdiffstats
path: root/Lib/doctest.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2008-12-15 11:48:21 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2008-12-15 11:48:21 (GMT)
commit4d2e41b1a4478d8ba08d32bc532b4b6e9e8c9bf6 (patch)
treef44bc30a6da4d1bdda4c4dd192ddcb4591f0f489 /Lib/doctest.py
parentf8638a8d2181e7b021be7e838a9400e2319a9b4e (diff)
downloadcpython-4d2e41b1a4478d8ba08d32bc532b4b6e9e8c9bf6.zip
cpython-4d2e41b1a4478d8ba08d32bc532b4b6e9e8c9bf6.tar.gz
cpython-4d2e41b1a4478d8ba08d32bc532b4b6e9e8c9bf6.tar.bz2
Merged revisions 67790 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r67790 | nick.coghlan | 2008-12-15 21:41:05 +1000 (Mon, 15 Dec 2008) | 1 line Issue #4197: Fix the remaining part of the doctest-in-zipfile problem by giving linecache access to the module globals when available ........
Diffstat (limited to 'Lib/doctest.py')
-rw-r--r--Lib/doctest.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py
index 8a5a22c..3f2baa5 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -820,7 +820,15 @@ class DocTestFinder:
# given object's docstring.
try:
file = inspect.getsourcefile(obj) or inspect.getfile(obj)
- source_lines = linecache.getlines(file)
+ if module is not None:
+ # Supply the module globals in case the module was
+ # originally loaded via a PEP 302 loader and
+ # file is not a valid filesystem path
+ source_lines = linecache.getlines(file, module.__dict__)
+ else:
+ # No access to a loader, so assume it's a normal
+ # filesystem path
+ source_lines = linecache.getlines(file)
if not source_lines:
source_lines = None
except TypeError:
@@ -1433,8 +1441,10 @@ class DocTestRunner:
d = self._name2ft
for name, (f, t) in other._name2ft.items():
if name in d:
- print "*** DocTestRunner.merge: '" + name + "' in both" \
- " testers; summing outcomes."
+ # Don't print here by default, since doing
+ # so breaks some of the buildbots
+ #print "*** DocTestRunner.merge: '" + name + "' in both" \
+ # " testers; summing outcomes."
f2, t2 = d[name]
f = f + f2
t = t + t2