<br><br><div class="gmail_quote">On Tue, Apr 6, 2010 at 8:46 AM, Michael Foord <span dir="ltr">&lt;<a href="mailto:fuzzyman@voidspace.org.uk">fuzzyman@voidspace.org.uk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">



  

<div text="#000000" bgcolor="#ffffff"><div class="im">
On 06/04/2010 13:43, Alfredo Deza wrote:
<blockquote type="cite"><br>
  <br>
  <div class="gmail_quote">On Tue, Apr 6, 2010 at 8:32 AM, Michael
Foord <span dir="ltr">&lt;<a href="mailto:fuzzyman@voidspace.org.uk" target="_blank">fuzzyman@voidspace.org.uk</a>&gt;</span>
wrote:<br>
  <blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
    <div text="#000000" bgcolor="#ffffff">
    <div>
    <div>On 06/04/2010 13:22, Alfredo Deza wrote:
    <blockquote type="cite">Hi,
      <div><br>
      </div>
      <div>I am trying to test as much as I can in a small project of
mine.
However, the project has some network usage: pushes files from one spot
to another with Mercurial via SSH.</div>
      <div><br>
      </div>
      <div>For now, I am creating a testing environment where I have
some
SSH keys enabled and I am able to test this specific functionality.</div>
      <div><br>
      </div>
      <div>However, I also have specific tests for all the
methods/functions involved. I had a user complain about the network
tests breaking (which is expected if he doesn&#39;t have a proper setup)
but I find it very</div>
      <div>useful to have not only tests for methods/functions but also
for
the final output: did the file actually made it?</div>
      <div><br>
      </div>
      <div>Is this approach OK? </div>
      <div><br>
      </div>
      <div>I have had situations where a test for a specific method
didn&#39;t
picked up an error but the &#39;test_final_ouput.py&#39; did (which made me
correct the tests).</div>
      <div><br>
      </div>
      <div>Maybe I should not include them when distributing my
project? Or
would documentation explaining how to set everything up so tests can
run correctly would be enough?</div>
    </blockquote>
    <br>
    </div>
    </div>
Having functional tests (end-to-end, integration tests, whatever you
want to call them) is a good thing - however ideally they should
*still* not rely on external resources. Really your test infrastructure
should setup the server your tests connect to locally. </div>
  </blockquote>
  <div><br>
  </div>
  <div>So something like mocking SSH? So it doesn&#39;t break if it is not
correctly implemented? <br>
  </div>
  </div>
</blockquote>
<br></div>
No - I was thinking of using real SSH, but only using it locally, which
is what you are doing. The tests should ideally do the setup though -</div></blockquote><div><br></div><div>Oh, ok, I didn&#39;t think of having the tests setup the correct SSH environment.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div text="#000000" bgcolor="#ffffff">
and should fail with a sensible error message if resources they depend
on are not available.<br></div></blockquote><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div text="#000000" bgcolor="#ffffff">
<br>
For your unit tests you should mock - but having at least some tests
doing full end-to-end testing is very valuable.<br></div></blockquote><div><br></div><div>Yes they are (and they have proved that) but just wanted to make sure asking the list. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div text="#000000" bgcolor="#ffffff"><font color="#888888">
<br>
Michael</font><div class="im"><br>
<br>
<blockquote type="cite">
  <div class="gmail_quote">
  <div>The tests right this moment *are* local, but still use SSH to
move the files from one spot to the other (e.g. &#39;ssh foo@localhost&#39;)</div>
  <div> </div>
  <blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
    <div text="#000000" bgcolor="#ffffff">If these tests
have dependencies then you should document these.<br>
    </div>
  </blockquote>
  <div><br>
  </div>
  <div>Always! </div>
  <blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
    <div text="#000000" bgcolor="#ffffff"><br>
My 0.02c.<br>
    </div>
  </blockquote>
  <div><br>
  </div>
  <div>I was going to ask how much I owed you... </div>
  <blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
    <div text="#000000" bgcolor="#ffffff"><br>
Michael Foord<br>
    <br>
    <blockquote type="cite">
      <div><br>
      </div>
      <div>Thanks!<br clear="all">
      <br>
-- <br>
Alfredo Deza<br>
      <br>
      </div>
      <pre><fieldset></fieldset>
_______________________________________________
testing-in-python mailing list
<a href="mailto:testing-in-python@lists.idyll.org" target="_blank">testing-in-python@lists.idyll.org</a>
<a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a>
  </pre>
    </blockquote>
    <br>
    <br>
    <pre cols="72">-- 
<a href="http://www.ironpythoninaction.com/" target="_blank">http://www.ironpythoninaction.com/</a>
<a href="http://www.voidspace.org.uk/blog" target="_blank">http://www.voidspace.org.uk/blog</a>

READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.

    </pre>
    </div>
  </blockquote>
  </div>
  <br>
  <br clear="all">
  <br>
-- <br>
Alfredo Deza<br>
  <br>
</blockquote>
<br>
<br>
<pre cols="72">-- 
<a href="http://www.ironpythoninaction.com/" target="_blank">http://www.ironpythoninaction.com/</a>
<a href="http://www.voidspace.org.uk/blog" target="_blank">http://www.voidspace.org.uk/blog</a>

READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.

</pre>
</div></div>

</blockquote></div><br><br clear="all"><br>-- <br>Alfredo Deza<br><br>