test_integrates_with_template_rendering.py 文件源码

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

项目:django-performance-testing 作者: PaesslerAG 项目源码 文件源码
def test_has_support_for_number_of_queries_in_templates(db, settings):
    settings.PERFORMANCE_LIMITS = {
        'Template.render': {
            'queries': {
                'total': 0
            }
        }
    }
    template = loader.get_template('all-group-names.markdown')
    with pytest.raises(LimitViolationError) as excinfo:
        template.render(context={'groups': Group.objects.all()})

    assert excinfo.value.context == {'template': ['all-group-names.markdown']}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号