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 Changes between 1.2.1 and 1.3.0
================================================== ==================================================

View File

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