Sorry, yes, I see your original code again now, so yeah I sent you on the wrong track a bit, sorry, (though clearing out some of the clutter hopefully helps).<div><br></div><div>So, your error says your object doesn&#39;t have a config attr because it doesn&#39;t. All you&#39;ve done is mocked super so that it returns a mock object, but that object is not really the superclass of DevBuild, and DevBuild never runs Build.__init__, and never sets its own config object.</div>

<div><br></div><div>So, if you want to have a config attr, you have to set it, presumably to a mock object (in addition to patching super or slightly better Build.__init__ to ensure it isn&#39;t run).</div><div><br></div>
<div>Julian<span></span></div><div><br>On Thursday, December 20, 2012, Ken Hagler  wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Dec 20, 2012, at 9:01 AM, Julian Berman &lt;<a>julian@grayvines.com</a>&gt; wrote:<br>

<br>
&gt; You need to replace in the module under test (can&#39;t link to the docs but<br>
&gt; there&#39;s a helpful article there if you can&#39;t figure it out).<br>
&gt;<br>
&gt; Something like:<br>
&gt;<br>
&gt; with mock.patch(&quot;mymodule.super&quot;, create=True) as mock_super:<br>
&gt;    mock_super.return_value.config.whatever = 12<br>
&gt;     exercise()<br>
&gt;     assert()<br>
<br>
Okay I tried this, so now test_init starts:<br>
<br>
with patch(&#39;DevBuild.super&#39;, create=True) as mock_super:<br>
            mock_MakeDevBuild = MagicMock()<br>
            mock_super.return_value.config.MakeDevBuild = mock_MakeDevBuild<br>
<br>
This is certainly simpler, but it also produces the same error: &quot;AttributeError: &#39;DevBuild&#39; object has no attribute &#39;config&#39;&quot;<br>
--<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></div>