[Zope3-checkins] SVN: Zope3/trunk/src/zope/testing/doctest.py add
__file__ to the globals available for tests loaded via
DocFileSuite;
Fred L. Drake, Jr.
fdrake at gmail.com
Tue Dec 21 18:37:52 EST 2004
Log message for revision 28679:
add __file__ to the globals available for tests loaded via DocFileSuite;
this is useful for locating supporting data files, just as it is in Python
modules
(also being added for Python 2.5, along with docs and tests)
Changed:
U Zope3/trunk/src/zope/testing/doctest.py
-=-
Modified: Zope3/trunk/src/zope/testing/doctest.py
===================================================================
--- Zope3/trunk/src/zope/testing/doctest.py 2004-12-21 23:28:27 UTC (rev 28678)
+++ Zope3/trunk/src/zope/testing/doctest.py 2004-12-21 23:37:50 UTC (rev 28679)
@@ -2352,6 +2352,8 @@
globs=None, parser=DocTestParser(), **options):
if globs is None:
globs = {}
+ else:
+ globs = globs.copy()
if package and not module_relative:
raise ValueError("Package may only be specified for module-"
@@ -2361,6 +2363,8 @@
if module_relative:
package = _normalize_module(package)
path = _module_relative_path(package, path)
+ if "__file__" not in globs:
+ globs["__file__"] = path
# Find the file and read it.
name = os.path.basename(path)
More information about the Zope3-Checkins
mailing list