Vir*_*ako 12 python nose cprofile
nosetest --with-profile --profile-stats-file输出
runsnake无法读取输出,因为nosetest使用hotshot,如果我想生成一个可以使用runsnake读取的文件,我需要将其转换为:
st = hotshot.stats.load('output')
st.dump_stats( 'output_new')
我可以直接使用cProfile运行测试以使用runsnake进行读取吗?
Dou*_*tti 10
进化上@squid的答案,你可以使用一个鼻子插件叫做nose-cprof更换鼻默认探查,能手,有CPROFILE.
要安装它:
pip install nose-cprof
Run Code Online (Sandbox Code Playgroud)
然后像这样打电话给鼻子:
nosetests --with-cprofile
Run Code Online (Sandbox Code Playgroud)
它应该生成一个cProfile输出文件,然后您可以使用像这样的工具进行分析runsnakerun.
除了它是 python 项目之外,我没有关于 nostest 的信息。所以;
python -m cProfile -o outputfile nosetest
Run Code Online (Sandbox Code Playgroud)
然后,
runsnake outputfile
Run Code Online (Sandbox Code Playgroud)
RunSnakeRun 对于可视化分析器非常有用。
注意:要运行runsnake,您必须安装wx和numpy。
更新:来自 omikron 的评论;runningnakerrun 无法支持 python3 配置文件输出。(我没有尝试)
| 归档时间: |
|
| 查看次数: |
3316 次 |
| 最近记录: |