def test_capture_warnings(recwarn): warnings.simplefilter('always') try: f() except CustomException: tb = offlinetb.distill(var_depth=4) [v] = [v for v in tb['traceback'][-1]['vars'] if v['name'] == 's'] assert v['vars'][0]['value'] == "'hi'" assert len(recwarn) == 0
def setUp(self): super(OfflineTbTest, self).setUp() try: f() except SomeException: self.offlinetb = distill(var_depth=4) validate_schema(self.offlinetb) self.tb = self.offlinetb['traceback'] self.f_frame = self.tb[-2] self.g_frame = self.tb[-1] self.obj = self._find_var_by_name(self.f_frame['vars'], 'obj') self.oldstyle_obj = self._find_var_by_name(self.f_frame['vars'], 'oldstyle_obj')
def setUp(self): super(NonPrintableExceptionTest, self).setUp() try: raise NonPrintableException() except NonPrintableException: self.offlinetb = distill()