[Checkins] SVN: manuel/branches/jim-multiple-doctest/src/manuel/ Fixed, really

Jim Fulton jim at zope.com
Wed Jan 19 13:55:01 EST 2011


Log message for revision 119729:
  Fixed, really

Changed:
  U   manuel/branches/jim-multiple-doctest/src/manuel/README.txt
  U   manuel/branches/jim-multiple-doctest/src/manuel/doctest.py
  U   manuel/branches/jim-multiple-doctest/src/manuel/tests.py

-=-
Modified: manuel/branches/jim-multiple-doctest/src/manuel/README.txt
===================================================================
--- manuel/branches/jim-multiple-doctest/src/manuel/README.txt	2011-01-19 18:52:03 UTC (rev 119728)
+++ manuel/branches/jim-multiple-doctest/src/manuel/README.txt	2011-01-19 18:55:00 UTC (rev 119729)
@@ -316,6 +316,7 @@
     ...     >>> j += 1
     ...     >>> j
     ...     1
+    ...
     ... """)
     >>> document.process_with(m, globs={})
     >>> print document.formatted(),
@@ -605,6 +606,7 @@
 Now when we have a failure, only the genuinely referenced variables will be
 included in the debugging information.
 
+    >>> document = manuel.Document(document.source)
     >>> document.process_with(m, globs={})
     >>> print document.formatted(),
     File "<memory>", line 10, in <memory>

Modified: manuel/branches/jim-multiple-doctest/src/manuel/doctest.py
===================================================================
--- manuel/branches/jim-multiple-doctest/src/manuel/doctest.py	2011-01-19 18:52:03 UTC (rev 119728)
+++ manuel/branches/jim-multiple-doctest/src/manuel/doctest.py	2011-01-19 18:55:00 UTC (rev 119729)
@@ -58,7 +58,7 @@
     # If the parsed object is not a doctest Example then we don't need to
     # handle it.
 
-    if getattr(region, '_manual', None) is not m:
+    if getattr(region.parsed, '_manual', None) is not m:
         return
 
     result = DocTestResult()

Modified: manuel/branches/jim-multiple-doctest/src/manuel/tests.py
===================================================================
--- manuel/branches/jim-multiple-doctest/src/manuel/tests.py	2011-01-19 18:52:03 UTC (rev 119728)
+++ manuel/branches/jim-multiple-doctest/src/manuel/tests.py	2011-01-19 18:55:00 UTC (rev 119729)
@@ -1,3 +1,4 @@
+import doctest
 import manuel
 import manuel.capture
 import manuel.codeblock
@@ -18,6 +19,30 @@
     (re.compile(r"<unittest\.result\.TestResult"), '<unittest.TestResult'),
     ])
 
+def turtle_on_the_bottom_test():
+    """We use manuel to test itself.
+
+    This means that if we completely hose manuel, we might not
+    know. Use doctest to do a basic sanity check.
+
+    >>> document = manuel.Document('''This is my doctest.
+    ...
+    ...     >>> 2 + 2
+    ...     5
+    ... ''')
+    >>> document.process_with(manuel.doctest.Manuel(), globs={})
+    >>> print document.formatted()
+    File "<memory>", line 3, in <memory>
+    Failed example:
+        2 + 2
+    Expected:
+        5
+    Got:
+        4
+    <BLANKLINE>
+
+    """
+
 def test_suite():
     tests = ['../index.txt', 'table-example.txt', 'README.txt', 'bugs.txt',
         'capture.txt']
@@ -31,9 +56,16 @@
     m += manuel.testcase.SectionManuel()
     # The apparently redundant "**dict()" is to make this code compatible with
     # Python 2.5 -- it would generate a SyntaxError otherwise.
-    return manuel.testing.TestSuite(m, *tests, **dict(
+    suite = manuel.testing.TestSuite(m, *tests, **dict(
         globs={'path_to_test': os.path.join(here, 'bugs.txt')}))
 
 
+    return unittest.TestSuite((
+        suite,
+        doctest.DocTestSuite(),
+        ))
+
+
+
 if __name__ == '__main__':
     unittest.TextTestRunner().run(test_suite())



More information about the checkins mailing list