Unitest mock issue

Joseph L. Casale jcasale at activenetwerx.com
Fri Feb 14 22:08:20 CET 2014


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


More information about the Python-list mailing list