summaryrefslogtreecommitdiffstats
path: root/Lib/doctest.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-01-27 09:52:35 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-01-27 09:52:35 (GMT)
commitf93f3032c63906d0a6516d6e75985f0d425f36f5 (patch)
treef0a305225d17ee6a2a5734e1f7bae8db5eae83c2 /Lib/doctest.py
parent2976aaa39666229fa9591f219b4642f8ccbcc30a (diff)
downloadcpython-f93f3032c63906d0a6516d6e75985f0d425f36f5.zip
cpython-f93f3032c63906d0a6516d6e75985f0d425f36f5.tar.gz
cpython-f93f3032c63906d0a6516d6e75985f0d425f36f5.tar.bz2
Stronger tests for combinatoric relationships.
Diffstat (limited to 'Lib/doctest.py')
-rw-r--r--Lib/doctest.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py
index 3f2baa5..aeeb15d 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -844,6 +844,8 @@ class DocTestFinder:
globs = globs.copy()
if extraglobs is not None:
globs.update(extraglobs)
+ if '__name__' not in globs:
+ globs['__name__'] = '__main__' # provide a default module name
# Recursively expore `obj`, extracting DocTests.
tests = []
@@ -1937,6 +1939,8 @@ def testfile(filename, module_relative=True, name=None, package=None,
globs = globs.copy()
if extraglobs is not None:
globs.update(extraglobs)
+ if '__name__' not in globs:
+ globs['__name__'] = '__main__'
if raise_on_error:
runner = DebugRunner(verbose=verbose, optionflags=optionflags)