test_querycount_limits.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:django-performance-testing 作者: PaesslerAG 项目源码 文件源码
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'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号