[TIP] Tracking memory usage during tests

Thomas Trenner thomas.trenner at gmail.com
Sun Mar 30 09:23:30 PDT 2014


I'm using py.test to run interface and high-level tests for a C++ library
(Win7, via a python interface).
I am also using the timings coming from the junit-xml output to do some
statistical analysis
that should detect any performance degradations. One other thing I am
concerned about though
is memory usage - as the actual memory-allocating code is written in C++.

Does anyone know of an approach that would give me memory usage statistics
while running the
tests? I thought about changing the assert statements to first log the
memory usage of the process
before doing the actual assert, using something like psutil, but I am not
sure whether this will give a
useful metric? One key question there is whether py.test - in
single-process mode - will always run
the tests in the same order unless tests are added/removed?

I welcome any suggestions on alternative approaches.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20140330/e1500a0a/attachment.htm>

More information about the testing-in-python mailing list