[Checkins] SVN: manuel/branches/jim-multiple-doctest/ Fixed
Jim Fulton
jim at zope.com
Wed Jan 19 11:35:43 EST 2011
Log message for revision 119721:
Fixed
Changed:
U manuel/branches/jim-multiple-doctest/CHANGES.txt
U manuel/branches/jim-multiple-doctest/src/manuel/doctest.py
-=-
Modified: manuel/branches/jim-multiple-doctest/CHANGES.txt
===================================================================
--- manuel/branches/jim-multiple-doctest/CHANGES.txt 2011-01-19 16:26:29 UTC (rev 119720)
+++ manuel/branches/jim-multiple-doctest/CHANGES.txt 2011-01-19 16:35:43 UTC (rev 119721)
@@ -1,6 +1,13 @@
CHANGES
=======
+1.4.1 (2011-01-19)
+------------------
+
+- Fixed a bug that caused extra example evaluation if multiple doctest
+ manuels were used at once (e.g. to execute Python and shell code in
+ the same document).
+
1.4.0 (2011-01-11)
------------------
Modified: manuel/branches/jim-multiple-doctest/src/manuel/doctest.py
===================================================================
--- manuel/branches/jim-multiple-doctest/src/manuel/doctest.py 2011-01-19 16:26:29 UTC (rev 119720)
+++ manuel/branches/jim-multiple-doctest/src/manuel/doctest.py 2011-01-19 16:35:43 UTC (rev 119721)
@@ -9,7 +9,7 @@
pass
-def parse(document, parser):
+def parse(self, document, parser):
for region in list(document):
if region.parsed:
continue
@@ -19,6 +19,8 @@
# If the chunk contains prose (as opposed to and example), skip it.
if isinstance(chunk, basestring):
continue
+
+ chunk._manual = self
chunk_line_count = (chunk.source.count('\n')
+ chunk.want.count('\n'))
@@ -55,7 +57,8 @@
def evaluate(m, region, document, globs):
# If the parsed object is not a doctest Example then we don't need to
# handle it.
- if not isinstance(region.parsed, doctest.Example):
+
+ if getattr(region, '_manual', None) is not m:
return
result = DocTestResult()
@@ -102,5 +105,5 @@
parser = parser or doctest.DocTestParser()
manuel.Manuel.__init__(
self,
- [lambda document: parse(document, parser)],
+ [lambda document: parse(self, document, parser)],
[evaluate_closure], [format])
More information about the checkins
mailing list