nosetest --with-profile --profile-stats-file output
The output can't read by runsnake, because nosetest uses hotshot, if I want to generate a file that can be read with runsnake, I need to convert it so:
st = hotshot.stats.load('output')
st.dump_stats('output_new')
Could I run the test with cProfile directly for read with runsnake?
Evolving on the answer of @squid, you can use a nose plugin called nose-cprof
to replace the nose default profiler, hotshot, with cProfile.
To install it:
pip install nose-cprof
Then call nose like this:
nosetests --with-cprofile
It should generate a cProfile output file, that you can then analyze with tools like runsnakerun
.
@cihanpesend's answer didn't quite work for me (cProfile couldn't find 'nosetests'), but I did have success on Linux using:
python -m cProfile -o profile.out `which nosetests` .
The resulting output works fine in runsnake.
(Presumably on Windows you could replace which nosetests
with the hard-coded path to your nosetests top-level python script.)
I think you are right that the output from nosetests' hotshot profiler is not compatible with runsnake. Certainly the two don't play nice together out of the box for me either.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With