<div>Hi Jathan,</div><div><br></div>We generally wrap third party and IO libraries with our own interface. That way our unit tests can either <a href="http://martinfowler.com/articles/mocksArentStubs.html">mock or fake</a> that interface, and in production we provide the real interface. This requires <a href="http://en.wikipedia.org/wiki/Dependency_inversion_principle">dependency inversion</a>, so none of your code statically imports the IO library (sockets in this case).<div>
<br>As for Mox, we&#39;ve only used MockAnything(), which doesn&#39;t require passing in any interface. That sounds like it may solve your immediate challenge.</div><div><br></div><div>Best,</div><div>Steve</div><div><br>
<div class="gmail_quote">On Mon, Jul 30, 2012 at 4:38 PM, Jathan McCollum <span dir="ltr">&lt;<a href="mailto:jathan@gmail.com" target="_blank">jathan@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">
I have a need to mock the socket module, but without actually importing it first. I know some pretty sophisticated mocking can be done with Mox, but it requires that you import the real module into the namespace first.<div>

<br></div><div>I am doing some work on an embedded system that doesn&#39;t have _socket.so, which means I can&#39;t actually import the socket module, but I need to do some mocking of connections.</div><div><br></div><div>

Anyone have any pointers? Thanks in advance!</div><span class="HOEnZb"><font color="#888888"><div><div><br></div>-- <br>Jathan.<br>--<br>
</div>
</font></span><br>_______________________________________________<br>
socal-piggies mailing list<br>
<a href="mailto:socal-piggies@lists.idyll.org">socal-piggies@lists.idyll.org</a><br>
<a href="http://lists.idyll.org/listinfo/socal-piggies" target="_blank">http://lists.idyll.org/listinfo/socal-piggies</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Steve Wedig</div><a href="http://www.linkedin.com/in/wedig" target="_blank">http://www.linkedin.com/in/wedig</a><br>
</div>