Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #66328

Unitest mock issue

From "Joseph L. Casale" <jcasale@activenetwerx.com>
Subject Unitest mock issue
Date 2014-02-14 21:08 +0000
Newsgroups comp.lang.python
Message-ID <mailman.6937.1392412172.18130.python-list@python.org> (permalink)

Show all headers | View raw


I am trying to patch a method of a class thats proving to be less than trivial.

The module I am writing a test for, ModuleA imports another ModuleB and
instantiates a class from this. Problem is, ModuleA incorporates multiprocessing
queues and I suspect I am missing the patch as the object in question is retrieved
from a queue and unpickled, at which point the method is invoked on that retrieved
object immediately.

Before the class I am patching is pickled, I don't invoke the method, but if I mock
the entire class, I can clearly see I am replacing it before pickling. So, given it is
this same module I am pickling/unpickling, what nuance have I missed in just
replacing the method of interest during unpickling?

Thanks for any guidance,
jlc

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Unitest mock issue "Joseph L. Casale" <jcasale@activenetwerx.com> - 2014-02-14 21:08 +0000

csiph-web