繁体   English   中英

如何使用nosetests测量python单元测试的执行时间?

[英]How do I measure the execution time of python unit tests with nosetests?

有没有办法计算由nosetests运行的单个Python测试的执行时间?

您可以尝试在此处发布的鼻子插件: https//github.com/mahmoudimus/nose-timer (或通过pip / PyPi获得)。 您还可以使用内置插件--with-profile进行更严格的分析。

或者:

python -m cProfile -o profile.out `which nosetests` .

可以使用例如runsnakerun查看输出,这使得在视觉上非常明显地表现出性能问题。 (例如,它可能是许多测试间接调用的常用方法)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM