[py-svn] r8730 - py/dist/py/test/report/text

hpk at codespeak.net hpk at codespeak.net
Sat Jan 29 17:26:43 CET 2005


Author: hpk
Date: Sat Jan 29 17:26:43 2005
New Revision: 8730

Modified:
   py/dist/py/test/report/text/summary.py
Log:
for the time being, special case SyntaxErrors 
when reporting Collector Errors.  They are
just way too ugly. 



Modified: py/dist/py/test/report/text/summary.py
==============================================================================
--- py/dist/py/test/report/text/summary.py	(original)
+++ py/dist/py/test/report/text/summary.py	Sat Jan 29 17:26:43 2005
@@ -19,7 +19,16 @@
         self.out.sep("_")
         self.out.sep("_", "Collect Error")
         self.out.line()
-        self.repr_failure(error.excinfo) 
+        if isinstance(error.excinfo.value, SyntaxError): 
+            self.repr_syntaxerror(error.excinfo) 
+        else:     
+            self.repr_failure(error.excinfo) 
+
+    def repr_syntaxerror(self, excinfo): 
+        err = excinfo.value 
+        self.out.line(err.text) 
+        self.out.line("SyntaxError: %s" %(err.msg))
+        self.out.line("[%s:%d]" % (err.filename, err.lineno))
 
     def summary_collect_errors(self):
         for error in self.getlist(py.test.collect.Error):



More information about the pytest-commit mailing list