[py-svn] r30393 - py/dist/py/test/terminal
arigo at codespeak.net
arigo at codespeak.net
Sun Jul 23 13:27:26 CEST 2006
Author: arigo
Date: Sun Jul 23 13:27:25 2006
New Revision: 30393
Modified:
py/dist/py/test/terminal/terminal.py
Log:
Make the --tb=short kind of traceback robust against file not founds,
like the default --tb=long tracebacks.
Modified: py/dist/py/test/terminal/terminal.py
==============================================================================
--- py/dist/py/test/terminal/terminal.py (original)
+++ py/dist/py/test/terminal/terminal.py Sun Jul 23 13:27:25 2006
@@ -329,11 +329,15 @@
code = entry.frame.code
self.out.line(' File "%s", line %d, in %s' % (
code.raw.co_filename, entry.lineno+1, code.raw.co_name))
- fullsource = entry.frame.code.fullsource
try:
- source = [fullsource[entry.lineno].lstrip()]
- except IndexError:
- source = []
+ fullsource = entry.frame.code.fullsource
+ except py.error.ENOENT:
+ source = ["?"]
+ else:
+ try:
+ source = [fullsource[entry.lineno].lstrip()]
+ except IndexError:
+ source = []
if entry == last:
if source:
self.repr_source(source, 'E')
More information about the pytest-commit
mailing list