def test_integration_test_with_db(db):
with pytest.raises(LimitViolationError) as excinfo:
with override_current_context() as ctx:
with QueryBatchLimit(total=2) as limit:
ctx.enter(key='some', value='context')
list(Group.objects.all())
Group.objects.update(name='bar')
Group.objects.create(name='group')
assert excinfo.value.context == {'some': ['context']}
assert excinfo.value.limit_obj == limit
assert excinfo.value.limit == 2
assert excinfo.value.name == 'total'
test_querycount_limits.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录