[py-svn] r37204 - in py/branch/config/py: code test/rsession

fijal at codespeak.net fijal at codespeak.net
Tue Jan 23 16:31:15 CET 2007


Author: fijal
Date: Tue Jan 23 16:31:13 2007
New Revision: 37204

Modified:
   py/branch/config/py/code/representation.py
   py/branch/config/py/test/rsession/outcome.py
   py/branch/config/py/test/rsession/reporter.py
Log:
Add another part of code, which is shared between rsession/terminal.
(actually one line in lsession, but now at least looks a bit better ;-)


Modified: py/branch/config/py/code/representation.py
==============================================================================
--- py/branch/config/py/code/representation.py	(original)
+++ py/branch/config/py/code/representation.py	Tue Jan 23 16:31:13 2007
@@ -50,13 +50,13 @@
             assert isinstance(item.parent, py.test.collect.Generator) 
             # a generative test yielded a non-callable 
             fn, lineno = item.parent.getpathlineno() 
-        if root == fn: 
+        if root == fn:
             self.out.sep("_", "entrypoint: %s" %(modpath))
         else:
             self.out.sep("_", "entrypoint: %s %s" %(root.basename, modpath))
 
-    def repr_failure_explanation(self, excinfo, source): 
-        try: 
+    def repr_failure_explanation(self, excinfo, source):
+        try:
             s = str(source.getstatement(len(source)-1))
         except KeyboardInterrupt: 
             raise 
@@ -64,8 +64,7 @@
             s = str(source[-1])
         indent = " " * (4 + (len(s) - len(s.lstrip())))
         # get the real exception information out 
-        lines = excinfo.exconly(tryshort=True).split('\n') 
-        self.out.line('>' + indent[:-1] + lines.pop(0)) 
-        for x in lines: 
-            self.out.line(indent + x) 
-        return
+        lines = excinfo.exconly(tryshort=True).split('\n')
+        self.out.line('>' + indent[:-1] + lines.pop(0))
+        for x in lines:
+            self.out.line(indent + x)

Modified: py/branch/config/py/test/rsession/outcome.py
==============================================================================
--- py/branch/config/py/test/rsession/outcome.py	(original)
+++ py/branch/config/py/test/rsession/outcome.py	Tue Jan 23 16:31:13 2007
@@ -67,6 +67,11 @@
                 for x in "typename value traceback".split()]
         return "<ExcInfoRepr %s>" %(" ".join(l),)
 
+    def exconly(self, tryshort=False):
+        """ Somehow crippled version of original one
+        """
+        return "%s: %s" % (self.typename, self.value)
+
 class ReprOutcome(object):
     def __init__(self, repr_tuple):
         (self.passed, self.setupfailure, excinfo, self.skipped,

Modified: py/branch/config/py/test/rsession/reporter.py
==============================================================================
--- py/branch/config/py/test/rsession/reporter.py	(original)
+++ py/branch/config/py/test/rsession/reporter.py	Tue Jan 23 16:31:13 2007
@@ -165,7 +165,7 @@
             for index, entry in py.builtin.enumerate(traceback): 
                 self.out.line("%s: %s" % (entry.path, entry.lineno))
                 self.out.line(entry.source)
-        self.out.line("%s: %s" % (excinfo.typename, excinfo.value))
+        self.presenter.repr_failure_explanation(excinfo, entry.source)
     
     def skips(self):
         texts = {}



More information about the pytest-commit mailing list