コード例 #1
0
 def test_traceback_without_error(self):
     s = Span(None, 'test.span')
     s.set_traceback()
     assert not s.error
     assert not s.get_tag(errors.ERROR_MSG)
     assert not s.get_tag(errors.ERROR_TYPE)
     assert 'in test_traceback_without_error' in s.get_tag(errors.ERROR_STACK)
コード例 #2
0
    def test_traceback_with_error(self):
        s = Span(None, 'test.span')
        try:
            1 / 0
        except ZeroDivisionError:
            s.set_traceback()
        else:
            assert 0, 'should have failed'

        assert s.error
        assert 'by zero' in s.get_tag(errors.ERROR_MSG)
        assert 'ZeroDivisionError' in s.get_tag(errors.ERROR_TYPE)