Django测试套件URL覆盖 [英] Django Test Suite URL Coverage

查看:134
本文介绍了Django测试套件URL覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想确保我的Django测试套件涵盖了我的URL配置中列出的所有URL。有没有办法将URL配置中的列表与测试套件中的URL列表进行比较?

I'd like to make sure that my Django test suite covers all URLs listed in my URL configuration. Is there a way to compare the list in the URL configuration to a list of URLs that have been hit during a test suite?

推荐答案

我能够通过定义一个自定义测试套件转轮来记录一个解决方案,记录正在访问的URL,并将其与配置的URL列表进行比较。

I was able to come up with a solution by defining a custom test suite runner that records the URLs being accessed and compares it to the list of configured URLs.

这是代码: http://djangosnippets.org/snippets/2694/

这篇关于Django测试套件URL覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆