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


Groups > comp.lang.python > #66328 > unrolled thread

Unitest mock issue

Started by"Joseph L. Casale" <jcasale@activenetwerx.com>
First post2014-02-14 21:08 +0000
Last post2014-02-14 21:08 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

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

#66328 — Unitest mock issue

From"Joseph L. Casale" <jcasale@activenetwerx.com>
Date2014-02-14 21:08 +0000
SubjectUnitest mock issue
Message-ID<mailman.6937.1392412172.18130.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web