avoid helper functions showing up in py.test tracebacks

--HG--
branch : trunk
This commit is contained in:
holger krekel 2010-05-11 17:43:56 +02:00
parent f266c8f92f
commit 0f5ed3abc7
2 changed files with 10 additions and 0 deletions

View File

@ -1,3 +1,9 @@
Changes between 1.3.0 and 1.3.1
==================================================
- improve tracebacks showing:
- raises shows shorter more relevant tracebacks
Changes between 1.2.1 and 1.3.0
==================================================

View File

@ -175,6 +175,7 @@ else:
def exec_(obj, globals=None, locals=None):
""" minimal backport of py3k exec statement. """
__tracebackhide__ = True
if globals is None:
frame = sys._getframe(1)
globals = frame.f_globals
@ -187,14 +188,17 @@ else:
if sys.version_info >= (3,0):
exec ("""
def _reraise(cls, val, tb):
__tracebackhide__ = True
assert hasattr(val, '__traceback__')
raise val
""")
else:
exec ("""
def _reraise(cls, val, tb):
__tracebackhide__ = True
raise cls, val, tb
def exec2(obj, globals, locals):
__tracebackhide__ = True
exec obj in globals, locals
""")