<div dir="ltr"><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Dec 20, 2012 at 2:08 AM, Frank Shearar <span dir="ltr">&lt;<a href="mailto:frank.shearar@gmail.com" target="_blank">frank.shearar@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":gu">So I tried an experiment last night where I manually re-added<br>
MCMockClassA &gt;&gt; #one, which failed dismally. Would adding<br>
&quot;MCMockPackageInfo initialize&quot; be the right thing to do in MCTestCase<br>
&gt;&gt; #tearDown? (That seems kind&#39;ve strange; I don&#39;t see why that would<br>
re-add a deleted method, for instance. Unless initialising wiped out<br>
local changes... I&#39;ll try this out on the train to work today.)<br>
<div class="im"></div></div></blockquote></div><br></div><div class="gmail_extra" style>It just needs to be executed before the image is shipped. The problem is that PackageInfo class&gt;&gt;named: used to find PackageInfo subclasses, back when the MC tests were written. Then the behaviour of PackageInfo was changed, so that PackageInfo subclasses have to register themselves during class initialization. But since MC was already in the base image, the class initialize method for MCMockPackageInfo was never called. </div>
<div class="gmail_extra" style><br></div><div class="gmail_extra" style>As a result, the &#39;MonticelloMocks&#39; package that the MC tests use is a vanilla PackageInfo instance, which is empty. That leads to the MCSnapshotResource for a test run being empty, which causes #tearDown methods to fail to restore the mocks after a test that alters them. That&#39;s why #one is missing.</div>
<div class="gmail_extra" style><br></div><div class="gmail_extra" style>Ultimately, this isn&#39;t a problem in the code, it&#39;s in the state of the image. All you have to do is execute &quot;MCMockPackageInfo initialize&quot; *before* running the tests, and everything works fine. Add it to ReleaseBuilder so that the image will ship with a properly initialized mocks package. </div>
<div class="gmail_extra" style><br></div><div class="gmail_extra" style>Colin</div></div>