It is OK for one of these tests to raise an exception -- that is often
the only reasonable thing to do when you'd otherwise crash -- but the
@no_gdb_backtrace decorator would not clean up in that case, leading to
no gdb backtraces for all subsequent tests.
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
def no_gdb_backtrace(f):
from os import environ
def w(*args, **kwargs):
- environ['PLEASE_NO_GDB_BACKTRACE'] = '1'
- f(*args, **kwargs)
- del environ['PLEASE_NO_GDB_BACKTRACE']
+ environ['PLEASE_NO_GDB_BACKTRACE'] = '1'
+ try:
+ f(*args, **kwargs)
+ finally:
+ del environ['PLEASE_NO_GDB_BACKTRACE']
return w