Accumulating cProfile stats between runs
I'm looking for a way to accumulate cprofile stats in the output file between runs. In the current code of nose-cprof, by using function cProfile.dump_stats(..), it'll overwrite the current file and as a consequence will not accumulate stats with previous runs.
Here's a link towards the code of dump_stats() that didn't seem to change from 2.7 to 3.6 at least:
https://github.com/python/cpython/blob/master/Lib/cProfile.py#L44-L48
Strangely enough for me, you provide a --cprofile-stats-erase command line argument that allows to erase the file prior to a cprofile run... at first glance, discovering this possibility, I expected then that the stats where actually accumulating in a possibily pre-existing file if we didn't provide this command line argument.
The code to get the accumulation is quick to write and I'm ready to send you a PR, but are you interested in that feature, or if not, could you tell me why you provide --cprofile-stats-erase if you are going to ignore the content of that file anyway ?
Did I miss anything ?
Many thanks for your attention and for writing this nose plugin.
First of all, thanks for opening this issue!
The behavior you describe (accumulating data across multiple runs) was indeed the original behavior that I intended, and your understanding of the reasoning behind --cprofile-stats-erase is correct. It has been some time since I’ve worked on this plugin, though, so my memory of the original implementation details is a bit fuzzy.
I would definitely appreciate a PR that fixes this issue! I am traveling at the moment so might not be able to look at it for a day or so, but promise to look at it as soon as I can.