[Zope3-checkins] SVN: zope.testing/branches/regebro-python3-reloaded/src/zope/testing/testrunner/ More formatting errors fixed.

Lennart Regebro regebro at gmail.com
Tue Dec 8 02:54:02 EST 2009


Log message for revision 106266:
  More formatting errors fixed.
  

Changed:
  U   zope.testing/branches/regebro-python3-reloaded/src/zope/testing/testrunner/formatter.py
  U   zope.testing/branches/regebro-python3-reloaded/src/zope/testing/testrunner/testrunner-colors.txt
  U   zope.testing/branches/regebro-python3-reloaded/src/zope/testing/testrunner/tests.py

-=-
Modified: zope.testing/branches/regebro-python3-reloaded/src/zope/testing/testrunner/formatter.py
===================================================================
--- zope.testing/branches/regebro-python3-reloaded/src/zope/testing/testrunner/formatter.py	2009-12-08 07:06:25 UTC (rev 106265)
+++ zope.testing/branches/regebro-python3-reloaded/src/zope/testing/testrunner/formatter.py	2009-12-08 07:54:02 UTC (rev 106266)
@@ -328,7 +328,10 @@
     def format_traceback(self, exc_info):
         """Format the traceback."""
         v = exc_info[1]
-        if isinstance(v, doctest.DocTestFailure):
+        if (isinstance(v, AssertionError) and 
+            v.args[0].startswith('Failed doctest test')):
+            tb = v.args[0]
+        elif isinstance(v, doctest.DocTestFailure):
             tb = doctest_template % (
                 v.test.filename,
                 v.test.lineno + v.example.lineno + 1,
@@ -564,7 +567,10 @@
         print
         print self.colorize('error', msg)
         v = exc_info[1]
-        if isinstance(v, doctest.DocTestFailure):
+        if (isinstance(v, AssertionError) and 
+            v.args[0].startswith('Failed doctest test')):
+            self.print_doctest_failure(v.args[0])
+        elif isinstance(v, doctest.DocTestFailure):
             # I don't think these are ever used... -- mgedmin
             tb = self.format_traceback(exc_info)
             print tb

Modified: zope.testing/branches/regebro-python3-reloaded/src/zope/testing/testrunner/testrunner-colors.txt
===================================================================
--- zope.testing/branches/regebro-python3-reloaded/src/zope/testing/testrunner/testrunner-colors.txt	2009-12-08 07:06:25 UTC (rev 106265)
+++ zope.testing/branches/regebro-python3-reloaded/src/zope/testing/testrunner/testrunner-colors.txt	2009-12-08 07:54:02 UTC (rev 106266)
@@ -103,7 +103,7 @@
       Tear down samplelayers.Layer122 in {green}0.000{normal} seconds.
       Tear down samplelayers.Layer12 in {green}0.000{normal} seconds.
       Tear down samplelayers.Layer1 in {green}0.000{normal} seconds.
-    Set up zope.testing.testrunner.layer.UnitTests in {green}N.NNN{normal} seconds.
+      Set up zope.testing.testrunner.layer.UnitTests in {green}N.NNN{normal} seconds.
     <BLANKLINE>
     <BLANKLINE>
     {boldred}Failure in test eek (sample2.sampletests_e){normal}
@@ -118,7 +118,7 @@
     {red}    Traceback (most recent call last):{normal}
     {red}      File ".../doctest.py", line 1356, in __run{normal}
     {red}        compileflags, 1) in test.globs{normal}
-    {red}      File "<doctest sample2.sampletests_e.eek[line 2, example 0]>", line 1, in ?{normal}
+    {red}      File "<doctest sample2.sampletests_e.eek[0]>", line 1, in ?{normal}
     {red}        f(){normal}
     {red}      File "testrunner-ex/sample2/sampletests_e.py", line 19, in f{normal}
     {red}        g(){normal}
@@ -156,9 +156,9 @@
     {red}    Traceback (most recent call last):{normal}
     {red}      File ".../doctest.py", line 1356, in __run{normal}
     {red}        compileflags, 1) in test.globs{normal}
-    {red}      File "<doctest e.txt[line 4, example 1]>", line 1, in ?{normal}
+    {red}      File "<doctest e.txt[1]>", line 1, in ?{normal}
     {red}        f(){normal}
-    {red}      File "<doctest e.txt[line 1, example 0]>", line 2, in f{normal}
+    {red}      File "<doctest e.txt[0]>", line 2, in f{normal}
     {red}        return x{normal}
     {red}    NameError: global name 'x' is not defined{normal}
     <BLANKLINE>
@@ -174,10 +174,10 @@
     {cyan}    raise self.failureException, \{normal}
     {red}AssertionError: 1 != 0{normal}
     <BLANKLINE>
-    {normal}  Ran {green}200{normal} tests with {boldred}3{normal} failures and {boldred}1{normal} errors in {green}0.045{normal} seconds.{normal}
+    {normal}  Ran {green}164{normal} tests with {boldred}3{normal} failures and {boldred}1{normal} errors in {green}0.045{normal} seconds.{normal}
     {normal}Tearing down left over layers:{normal}
     Tear down zope.testing.testrunner.layer.UnitTests in {green}N.NNN{normal} seconds.
-    {normal}Total: {green}413{normal} tests, {boldred}3{normal} failures, {boldred}1{normal} errors in {green}0.023{normal} seconds.{normal}
+    {normal}Total: {green}329{normal} tests, {boldred}3{normal} failures, {boldred}1{normal} errors in {green}0.023{normal} seconds.{normal}
     True
 
 

Modified: zope.testing/branches/regebro-python3-reloaded/src/zope/testing/testrunner/tests.py
===================================================================
--- zope.testing/branches/regebro-python3-reloaded/src/zope/testing/testrunner/tests.py	2009-12-08 07:06:25 UTC (rev 106265)
+++ zope.testing/branches/regebro-python3-reloaded/src/zope/testing/testrunner/tests.py	2009-12-08 07:54:02 UTC (rev 106266)
@@ -155,7 +155,7 @@
         'testrunner-layers.txt',
         'testrunner-layers-api.txt',
         'testrunner-progress.txt',
-        #'testrunner-colors.txt',
+        'testrunner-colors.txt',
         'testrunner-simple.txt',
         'testrunner-test-selection.txt',
         'testrunner-verbose.txt',



More information about the Zope3-Checkins mailing list