Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'retrieved': 0.05; 'class,': 0.07; 'method,': 0.09; 'thats': 0.09; 'missed': 0.12; 'for,': 0.16; 'imports': 0.16; 'received:172.18.0': 0.16; 'subject:issue': 0.16; 'module': 0.19; 'trying': 0.19; 'replacing': 0.19; 'to:name:python-list@python.org': 0.22; 'header:Received:8': 0.24; 'question': 0.24; 'point': 0.28; 'patch': 0.29; 'guidance,': 0.31; 'invoke': 0.31; 'class': 0.32; 'this.': 0.32; 'another': 0.32; 'problem': 0.35; 'test': 0.35; 'but': 0.35; 'method': 0.36; 'charset:us-ascii': 0.36; 'thanks': 0.36; 'so,': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'received:unknown': 0.61; 'entire': 0.61; 'interest': 0.64; 'mock': 0.84 X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=/24PZDiXryEUsaYH72AX4ulVzqSXihAXfE7Ql5lDP0I= c=1 sm=1 a=7PYXob_7ZXMA:10 a=P90J6pEA2ccA:10 a=BLceEmwcHowA:10 a=kj9zAlcOel0A:10 a=xqWC_Br6kY4A:10 a=oNw28mxuUhXRB3mVwYQ4Ag==:17 a=gntpD4ermqs0jSXcxTcA:9 a=CjuIK1q_8ugA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=activenetwerx.com; s=default; t=1392412102; bh=gaVg9bGHCcsqwadkkb7JH4o2+ygl1zTFHgILmf9q+uM=; h=From:To:Subject:Date; b=MRmGQ0WPHxYRQUuMER1wm9sxutIG5IFKVLTBEftuaNJxQT8+Gscszb243rYtI3Y0L YngklUSl76ZPs2Ny+arWdsX1F+gtkP4QK/wRqF3BN7aVguWQZ9msx70nwaSY4Qxkyg 2ptiJcvLFfitkWPadoZ5JfRUhqMsUd3uJvINlIIY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=activenetwerx.com; s=default; t=1392412101; bh=gaVg9bGHCcsqwadkkb7JH4o2+ygl1zTFHgILmf9q+uM=; h=From:To:Subject:Date; b=OMcRuQHSC67NaoMa/0gUXBE7ltuWcPAW57un+y+GB61net5O4KzsgtxULoFCUQuCb 5z4yqnlBLccFVI1mRFaJ1GCyn5MI37wknU/CfjvYzUT8KDHD470wZ/cCRkxhd3FkkI /3M7mMV7VvVBnEWqxdEQzSU7h7PCKr/VHMnvBsPk= X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.activenetwerx.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=ham version=3.3.1 From: "Joseph L. Casale" To: "python-list@python.org" Subject: Unitest mock issue Thread-Topic: Unitest mock issue Thread-Index: AQHPKcf9s8EFNEOuEEeeFGOGWfz3mg== Date: Fri, 14 Feb 2014 21:08:20 +0000 Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.18.0.4] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392412172 news.xs4all.nl 2913 [2001:888:2000:d::a6]:46167 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66328 I am trying to patch a method of a class thats proving to be less than triv= ial.=0A= =0A= The module I am writing a test for, ModuleA imports another ModuleB and=0A= instantiates a class from this. Problem is, ModuleA incorporates multiproce= ssing=0A= queues and I suspect I am missing the patch as the object in question is re= trieved=0A= from a queue and unpickled, at which point the method is invoked on that re= trieved=0A= object immediately.=0A= =0A= Before the class I am patching is pickled, I don't invoke the method, but i= f I mock=0A= the entire class, I can clearly see I am replacing it before pickling. So, = given it is=0A= this same module I am pickling/unpickling, what nuance have I missed in jus= t=0A= replacing the method of interest during unpickling?=0A= =0A= Thanks for any guidance,=0A= jlc=