Closed yarikoptic closed 8 years ago
That's what the kernprof
script is for. You just need to add the @profile
decorator to your own code, then.
script is good when I can use script. In this case I needed to run the tests, i.e. invocation was like "nosetests -s -v codebase/tests/test_whaterver.py:test_test", so invoking it with a script (btw -- not installed under bin/ by pip install) I guess wouldn't be feasible, or am I wrong? also it would require two actions -- modifying the test code (doing already) and adjusting command line (instead of as suggested -- such adjusting the code)
kernprof -lv nosetests -s -v ...etc
will work just fine. kernprof
is smart enough to go through your $PATH
to find the nosetests
script.
Thanks for the line_profilers -- does exactly what I needed: wanted to see what takes most of the time in the unittest. But to get such information I needed 4 lines at minimum...
I think it would be neat if I could just do
to accomplish the mission, i.e. if decorator could just print those stats after completing the test.