def test_wrapper_incr_safety(self):
# get the default cache
cache = caches['default']
# it should fail not because of our wrapper
with assert_raises(ValueError) as ex:
cache.incr('missing_key')
# the error is not caused by our tracer
eq_(ex.exception.args[0], "Key 'missing_key' not found")
# an error trace must be sent
spans = self.tracer.writer.pop()
eq_(len(spans), 2)
span = spans[0]
eq_(span.resource, 'incr')
eq_(span.name, 'django.cache')
eq_(span.span_type, 'cache')
eq_(span.error, 1)
评论列表
文章目录