<p>Hey Ken.</p>
<p>I can't elaborate much from here, but your issue is due to not replacing super in the correct spot, so your mom isn't being injected properly.</p>
<p>You need to replace in the module under test (can't link to the docs but there's a helpful article there if you can't figure it out).</p>
<p>Something like:</p>
<p>with mock.patch("mymodule.super", create=True) as mock_super:<br>
mock_super.return_value.config.whatever = 12<br>
exercise()<br>
assert()<br></p>
<p>Remembering your code from memory and typing off the cuff, but hopefully this puts you on your way, otherwise I'm sure someone else can pick it up from here. Also note the need for create.</p>
<p>Also, doing this is messy. You should give some thought into rethinking your design. Specifically, separating child from superclass is smelly, maybe the child ought not be a child at all (and maybe it should compose with the super).</p>
<p>Anyways, good luck</p>
<p>Julian</p>
<div class="gmail_quote">On Dec 20, 2012 9:49 AM, "Ken Hagler" <<a href="mailto:khagler@orange-road.com">khagler@orange-road.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Dec 19, 2012, at 2:57 PM, John Wong <<a href="mailto:gokoproject@gmail.com">gokoproject@gmail.com</a>> wrote:<br>
<br>
> I usually mock a class by using autospec parameter so the specs of the<br>
> class remains except it's MOCKed.<br>
> That allows me to just quickly mock out the class I want while keeping all<br>
> the necessary attributes/method I need.<br>
<br>
Reasonable, but would I use Build or DevBuild for that? I suppose I'm wary of adding another factor that I don't particularly understand when it's already not working...<br>
<br>
> Also, the error doesn't indicate it's a mock object. If it were a mock, I<br>
> believe you would see "MagicMock object" rather than DevBuild object.<br>
<br>
Okay, any idea what I'm doing wrong there?<br>
--<br>
Ken Hagler<br>
<br>
| <a href="http://www.orange-road.com/" target="_blank">http://www.orange-road.com/</a> |<br>
| And tho' we are not now that strength which in old days |<br>
| Moved earth and heaven, that which we are, we are --Tennyson |<br>
<br>
<br>
_______________________________________________<br>
testing-in-python mailing list<br>
<a href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a><br>
<a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a><br>
</blockquote></div>