[py-svn] r51292 - py/trunk/py/test

fijal at codespeak.net fijal at codespeak.net
Tue Feb 5 15:35:49 CET 2008


Author: fijal
Date: Tue Feb  5 15:35:49 2008
New Revision: 51292

Modified:
   py/trunk/py/test/representation.py
Log:
Just another except, in order to represent source when it's not there.


Modified: py/trunk/py/test/representation.py
==============================================================================
--- py/trunk/py/test/representation.py	(original)
+++ py/trunk/py/test/representation.py	Tue Feb  5 15:35:49 2008
@@ -71,8 +71,11 @@
             s = str(source.getstatement(len(source)-1))
         except KeyboardInterrupt: 
             raise 
-        except: 
-            s = str(source[-1])
+        except:
+            try:
+                s = str(source[-1])
+            except IndexError:
+                s = "<Cannot get source>"
         indent = " " * (4 + (len(s) - len(s.lstrip())))
         # get the real exception information out 
         lines = excinfo.exconly(tryshort=True).split('\n')



More information about the pytest-commit mailing list