Closed GoogleCodeExporter closed 9 years ago
patch works by replacing individual references with a mock. When you patch
__main__.B there is still a real B class, and it is still a subclass of A. So
A.__subclasses__()[0] is still the real class B - it doesn't do a dynamic
lookup in __main__ to find B and so patching B in __main__ can't affect it. You
could instead patch B.__new__ to return a mock when B is instantiated.
Original comment by fuzzyman
on 29 Aug 2012 at 7:15
Original issue reported on code.google.com by
jame...@percolate.com
on 29 Aug 2012 at 6:47Attachments: