<div dir="ltr"><br><div><br></div><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Olemis Lang</b> <span dir="ltr">&lt;<a href="mailto:olemis@gmail.com">olemis@gmail.com</a>&gt;</span><br>
Date: Thu, Feb 27, 2014 at 6:50 PM<br>Subject: Re: [TIP] Advice on location of tests modules<br>To: John Wong &lt;<a href="mailto:gokoproject@gmail.com">gokoproject@gmail.com</a>&gt;<br><br><br><div dir="ltr"><br><div class="gmail_quote">
<div class="">On Thu, Feb 27, 2014 at 6:03 PM, John Wong <span dir="ltr">&lt;<a href="mailto:gokoproject@gmail.com" target="_blank">gokoproject@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 dir="ltr"><div><div><div><div>I am not sure if I understood your question entirely, so correct me if necessary.<br><br>This is the source code I supposed:<br><a href="https://svn.apache.org/repos/asf/bloodhound/trunk/" target="_blank">https://svn.apache.org/repos/asf/bloodhound/trunk/</a><br>


<br></div></div></div></div></div></blockquote><div><br></div></div><div>yes</div><div class=""><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">
<div><div><div>
I&#39;ve looked at the structure a bit and found that you currently have tests under each product/package (for example, <a href="https://svn.apache.org/repos/asf/bloodhound/trunk/bloodhound_dashboard/bhdashboard/" target="_blank">https://svn.apache.org/repos/asf/bloodhound/trunk/bloodhound_dashboard/bhdashboard/</a>), also see <a href="https://svn.apache.org/repos/asf/bloodhound/trunk/bloodhound_dashboard/setup.py" target="_blank">https://svn.apache.org/repos/asf/bloodhound/trunk/bloodhound_dashboard/setup.py</a>)<br>


<br></div></div></div></div></blockquote><div><br></div></div><div>The structure is like this&nbsp;</div><div><br></div><div>+ /trunk</div><div>| +-- bloodhound_dashboard</div><div>| | &nbsp; &nbsp;+-- setup.py</div><div>| | &nbsp; &nbsp;+-- bhdashboard</div>

<div>| | &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;+-- ... plugin source code with sub packages ...</div><div>| | &nbsp; &nbsp; &nbsp; &nbsp; +-- tests</div><div>| | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+--- ... test code ...</div><div>| +-- bloodhound_multiproduct</div><div><div>| | &nbsp; &nbsp;+-- setup.py</div>

<div>| | &nbsp; &nbsp;+-- multiproduct</div><div>| | &nbsp; &nbsp;|&nbsp; &nbsp; +-- ... plugin source code with sub packages ...</div><div>| | &nbsp; &nbsp;+-- tests</div><div>| | &nbsp; &nbsp; &nbsp; &nbsp; +--- ... test code ...</div></div><div>| +-- bloodhound_relations</div>
<div>
<div>| | &nbsp; &nbsp;+-- setup.py</div><div>| | &nbsp; &nbsp;+-- bhrelations</div><div>| | &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;+-- ... plugin source code with sub packages ...</div><div>| | &nbsp; &nbsp; &nbsp; &nbsp; +-- tests</div><div>| | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+--- ... test code ...</div>| +-- bloodhound_search</div>

<div><div>| | &nbsp; &nbsp;+-- setup.py</div><div>| | &nbsp; &nbsp;+-- bhsearch</div><div>| | &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;+-- ... plugin source code with sub packages ...</div><div>| | &nbsp; &nbsp; &nbsp; &nbsp; +-- tests</div><div>| | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+--- ... test code ...</div></div>

<div>| +-- bloodhound_theme</div><div><div>| | &nbsp; &nbsp;+-- setup.py</div><div>| | &nbsp; &nbsp;+-- bhtheme</div><div>| | &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;+-- ... plugin source code with sub packages ...</div><div>| | &nbsp; &nbsp; &nbsp; &nbsp; +-- tests</div><div>| | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+--- ... test code ...</div>

| +-- trac</div><div class=""><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>I believe this means tests is also included in the package installation (when you run setup.py)<br>

</div></div></div></blockquote><div><br></div></div><div>no, afaict those folders are ignored in setup.py pkg defintion . For multiproduct module the separation is more obvious . Harder to see for trac source tree .</div>
<div class=""><div>&nbsp;</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><br></div>I prefer not to do that. I prefer to have my test folder next to setup.py. This means I shouldn&#39;t be importing bhdashboard.tests.test_xxxx&nbsp;&nbsp; and there is no reason to import that.<br>

</div></div></blockquote><div><br></div></div><div>In fact this something I do not like , require importing top-level source code package module in order to reach test code . Say functional test cases are written for a web product then importing src pkg means that its dependencies e.g. should be available at run time . This may be actually useless , because functional test code won use that but instead other packages like twill , selenium , xmlrpclib ... or any other client lib to automate interactions with the real instance , rather than the server code actually implementing those service . That coupling ... /me no likes ;)</div>
<div class="">
<div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>
<br></div><div>Should you combine all tests in a single directory? Examples:<br><a href="https://svn.apache.org/repos/asf/bloodhound/trunk/tests" target="_blank">https://svn.apache.org/repos/asf/bloodhound/trunk/tests</a><br>

<a href="https://svn.apache.org/repos/asf/bloodhound/trunk/tests/product1/" target="_blank">https://svn.apache.org/repos/asf/bloodhound/trunk/tests/product1/</a><br>
<a href="https://svn.apache.org/repos/asf/bloodhound/trunk/tests/product1/unittest" target="_blank">https://svn.apache.org/repos/asf/bloodhound/trunk/tests/product1/unittest</a><br><a href="https://svn.apache.org/repos/asf/bloodhound/trunk/tests/product1/functional" target="_blank">https://svn.apache.org/repos/asf/bloodhound/trunk/tests/product1/functional</a><br>


</div><div>and so on<br><br></div><div>I wouldn&#39;t do that. </div></div></blockquote><div><br></div></div><div>agreed .</div><div class=""><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr"><div>Each python package (I go by product1, product2, product3 here) should have its own tests directory (sits next to setup.py). </div></div></blockquote><div><br></div></div><div>You mean like bloodhound_multiproduct above ? That&#39;s the layout I prefer .</div>
<div class="">
<div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>If two packages share a lot of test utilities scripts (I call them test drivers), consider making those utilities into separate python package.<br>


<br></div></div></blockquote><div><br></div></div><div>+1</div><div class=""><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>That&#39;s just me. Most of my projects will end up in some PyPI data store (public or private) so I have a good reason to keep test folder separate.<br>

<br></div></div></blockquote><div><br></div></div><div>ok</div><div><br></div><div>[...]</div></div><div class=""><br>-- <br>Regards,<br><br>Olemis - @olemislc<br><br>Apache&trade; Bloodhound contributor<br><a href="http://issues.apache.org/bloodhound" target="_blank">http://issues.apache.org/bloodhound</a><br>

<a href="http://blood-hound.net" target="_blank">http://blood-hound.net</a><br><br>Blog ES: <a href="http://simelo-es.blogspot.com/" target="_blank">http://simelo-es.blogspot.com/</a><br>Blog EN: <a href="http://simelo-en.blogspot.com/" target="_blank">http://simelo-en.blogspot.com/</a><br>

<br>Featured article:<br><br><br>
</div></div>
</div><br><br clear="all"><br>-- <br>Regards,<br><br>Olemis - @olemislc<br><br>Apache&trade; Bloodhound contributor<br><a href="http://issues.apache.org/bloodhound">http://issues.apache.org/bloodhound</a><br><a href="http://blood-hound.net">http://blood-hound.net</a><br>
<br>Blog ES: <a href="http://simelo-es.blogspot.com/">http://simelo-es.blogspot.com/</a><br>Blog EN: <a href="http://simelo-en.blogspot.com/">http://simelo-en.blogspot.com/</a><br><br>Featured article:<br><br><br>
</div>