On Thursday, December 20, 2012, Ken Hagler  wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
&gt; So, if you want to have a config attr, you have to set it, presumably to a<br>
&gt; mock object<br>
<br>
Okay, how? If mocking super is useless, than how to I get that to happen?</blockquote><div><br></div><div>Well, like I said it&#39;s not useless if you don&#39;t want the super upcall to run. But it&#39;s not sufficient. </div>
<div><br></div><div>Set a mock like any other attribute. Here it&#39;s a bit uglier since you need to mock a thing that should be set in __init__ while you&#39;re testing __init__&#39;s behavior, but I guess you&#39;d do</div>
<div><br></div><div>with mock.patch.object(DevBuild, &quot;config&quot;) as config:</div><div>    self.d = DevBuild(whatever)</div><div>    config.assert_whatever()</div><br><div> in addition to the super mock.</div><div>
<br></div><div><br></div><div>Cheers,</div><div><br></div><div>Julian<span></span></div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
--<br>
                              Ken Hagler<br>
<br>
|                   <a href="http://www.orange-road.com/" target="_blank">http://www.orange-road.com/</a>                   |<br>
|   And tho&#39; we are not now that strength which in old days       |<br>
|   Moved earth and heaven, that which we are, we are --Tennyson  |<br>
<br>
</blockquote>