Unittest presents only total time spent on running all tests but does not present time spent on each test separately.
How to add timing of each test when using unittest?
Solution with command-line only:
1/ install nose
(popular alternative test-runner) and extension pinnochio
$ pip install nose pinnochio
2/ run tests with time recording (times are saved in file .nose-stopwatch-times
)
$ nosetests --with-stopwatch
3/ display tests names sorted by decreasing time:
$ python -c "import pickle,operator,signal; signal.signal(signal.SIGPIPE, signal.SIG_DFL); print '\n'.join(['%.03fs: %s'%(v[1],v[0]) for v in sorted(pickle.load(open('.nose-stopwatch-times','r')).items(), key=operator.itemgetter(1), reverse=True)])" | less