如何使用nosetests测量python单元测试的执行时间?
有没有办法计算由nosetests运行的单个Python测试的执行时间?
Is there a way to time the execution time of individual Python tests which are run by nosetests ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试这里发布的鼻子插件:https://github.com/mahmoudimus/nose-timer< /a> (或通过 pip / PyPi 获得)。您还可以使用内置插件
--with-profile
进行更严格的分析。You might try the nose plug-in posted here: https://github.com/mahmoudimus/nose-timer (or available via pip / PyPi). You can also use the built-in plugin
--with-profile
to do more serious profiling.或者:
可以使用例如 runsnakerun 查看输出,这使得它在视觉上非常直观很明显你的性能问题出在哪里。 (例如,它可能是许多测试间接调用的通用方法)
Alternatively:
The output from can be viewed using, for example, runsnakerun, which makes it visually very obvious where your performance problems are. (e.g. it might be in a common method that many tests indirectly call)