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">
> So, if you want to have a config attr, you have to set it, presumably to a<br>
> 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's not useless if you don't want the super upcall to run. But it's not sufficient. </div>
<div><br></div><div>Set a mock like any other attribute. Here it's a bit uglier since you need to mock a thing that should be set in __init__ while you're testing __init__'s behavior, but I guess you'd do</div>
<div><br></div><div>with mock.patch.object(DevBuild, "config") 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' 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>