[py-svn] r13911 - py/dist/py/test/terminal

hpk at codespeak.net hpk at codespeak.net
Sun Jun 26 09:35:57 CEST 2005


Author: hpk
Date: Sun Jun 26 09:35:55 2005
New Revision: 13911

Modified:
   py/dist/py/test/terminal/out.py
   py/dist/py/test/terminal/terminal.py
Log:
refining and streamlining the traceback output a bit 
hope you like it. 



Modified: py/dist/py/test/terminal/out.py
==============================================================================
--- py/dist/py/test/terminal/out.py	(original)
+++ py/dist/py/test/terminal/out.py	Sun Jun 26 09:35:55 2005
@@ -24,6 +24,8 @@
             line += sepchar * int(fullwidth-(half*2+size))
         else:
             line = sepchar * int(fullwidth/len(sepchar))
+        if len(line) != fullwidth: 
+            line += sepchar
         self.line(line)
 
 class TerminalOut(Out):

Modified: py/dist/py/test/terminal/terminal.py
==============================================================================
--- py/dist/py/test/terminal/terminal.py	(original)
+++ py/dist/py/test/terminal/terminal.py	Sun Jun 26 09:35:55 2005
@@ -260,9 +260,15 @@
             self.out.line("empty traceback from item %r" % (item,)) 
             return
         last = traceback[-1]
+        first = traceback[0]
         recursioncache = {}
         for entry in traceback: 
-            self.out.line("")
+            if entry == first: 
+                if item: 
+                    self.repr_failure_info(item, entry) 
+                    self.out.line()
+            else: 
+                self.out.line("")
             if entry == last: 
                 indent = self.repr_source(entry, 'E') 
                 self.repr_failure_explanation(excinfo, indent) 
@@ -274,8 +280,8 @@
 
             # trailing info 
             if entry == last: 
-                if item: 
-                    self.repr_failure_info(item, entry) 
+                #if item: 
+                #    self.repr_failure_info(item, entry) 
                 self.repr_out_err(item) 
                 self.out.sep("_")
             else: 
@@ -310,13 +316,14 @@
             assert isinstance(item.parent, py.test.collect.Generator) 
             # a generative test yielded a non-callable 
             fn, lineno = item.parent.getpathlineno() 
-        if fn != entry.frame.code.path or \
-           entry.frame.code.firstlineno != lineno: 
-            self.out.line("[testcode  : %s:%d]" % (fn, lineno+1)) 
+        # hum, the following overloads traceback output 
+        #if fn != entry.frame.code.path or \
+        #   entry.frame.code.firstlineno != lineno: 
+        #    self.out.line("testcode: %s:%d" % (fn, lineno+1)) 
         if root == fn: 
-            self.out.line("[modulepath: %s]" %(modpath))
+            self.out.sep("_", "entrypoint: %s" %(modpath))
         else:
-            self.out.line("[modulepath: %s %s]" %(root.basename, modpath))
+            self.out.sep("_", "entrypoint: %s %s" %(root.basename, modpath))
 
     def repr_source(self, entry, marker=">"): 
         try: 



More information about the pytest-commit mailing list