[TIP] How would you test something that deals with processes?

Geoff Bache geoff.bache at gmail.com
Wed Jun 8 12:14:27 PDT 2011

Hi John,

At a risk of blowing my own trumpet, this is exactly the kind of
situation for which I created my CaptureMock tool (which I've also
just released a new version of)

The basic idea is to set all the processes up for real, once, and
record the interaction with the key modules/functions/subprocesses
which handle the gathering of memory information and the killing of
the processes. This information can then be used as "generated mocks",
and used in a replay mode which just uses the information recorded to
simulate the interactions. Should your actual calls to these things
change, it will fail the test and suggest that you re-record.

The point is that this saves writing any mock code, and also saves on
having separate unit and integration tests  - the same test in
different modes can function as both.

Geoff Bache

On Tue, Jun 7, 2011 at 2:25 AM, John Anderson <sontek at gmail.com> wrote:
> I wrote this script that monitors memory usage of processes and kills them
> if they get too high.  I'm having a hard time figuring out how to test
> something like this.
> Would you just mock out the process list and test that if you pass it a
> process list it calls send_signal?  Thats what i'm thinking about doing but
> would like to hear other peoples opinions!
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python

More information about the testing-in-python mailing list