[Checkins] SVN: manuel/trunk/src/manuel/doctest.py fix line number reporting in doctest failures; needs tests

Benji York benji at zope.com
Wed Aug 26 09:42:31 EDT 2009


Log message for revision 103228:
  fix line number reporting in doctest failures; needs tests
  

Changed:
  U   manuel/trunk/src/manuel/doctest.py

-=-
Modified: manuel/trunk/src/manuel/doctest.py
===================================================================
--- manuel/trunk/src/manuel/doctest.py	2009-08-26 13:37:19 UTC (rev 103227)
+++ manuel/trunk/src/manuel/doctest.py	2009-08-26 13:42:31 UTC (rev 103228)
@@ -34,6 +34,10 @@
                 found = region
 
             document.claim_region(found)
+
+            # Since we're treating each example as a stand-alone thing, we need
+            # to reset its line number to zero.
+            chunk.lineno = 0
             found.parsed = chunk
 
             assert region in document
@@ -52,7 +56,7 @@
     runner.DIVIDER = '' # disable unwanted result formatting
     runner.run(
         doctest.DocTest([region.parsed], globs, test_name,
-            document.location, 0, None),
+            document.location, region.lineno-1, None),
         out=result.write, clear_globs=False)
     region.evaluated = result
 



More information about the Checkins mailing list