Hi,<div><br></div><div>I am having some issues with the Nose importer.</div><div><br></div><div>My project layout is set as follows:</div><div><br></div><div>/project</div><div>/project/lib</div><div>/project/tests</div><div>
<br></div><div>When I run &#39;nosetests -v&#39; in /project everything runs OK (tests import from within &#39;lib&#39;). </div><div><br></div><div>But when I am within /project/tests &#39;nosetests -v&#39; fails with an ImportError exception saying it cannot import the </div>
<div>files from lib on only *one* of the test files.</div><div><br></div><div>However, if I take the same test file that is throwing exceptions and run it against nose, it completes the tests successfully:</div><div><br></div>
<div>&#39;nosetests -v test_permissions.py&#39;</div><div><br></div><div>It also works fine when calling it via python:</div><div><br></div><div>&#39;python test_permissions.py&#39;</div><div><br></div><div>The one file that test_permissions.py is trying to import but is failing is: &#39;permissions&#39;, and it does so by:</div>
<div><br></div><div>sys.path.append(&#39;../&#39;)</div><div>from lib import hg, permissions, upgrade</div><div><br></div><div>I am not sure why it would be able to import &#39;hg&#39; and &#39;database&#39;, but fail to import &#39;permissions&#39;, and only when it runs all tests within the tests directory.</div>
<div><br></div><div>Here is a copy of one of the exceptions:</div><div><br></div><div><div><div>======================================================================</div><div>ERROR: Failure: ImportError (cannot import name permissions)</div>
<div>----------------------------------------------------------------------</div><div>Traceback (most recent call last):</div><div>  File &quot;/usr/local/lib/python2.6/dist-packages/nose/loader.py&quot;, line 382, in loadTestsFromName</div>
<div>    addr.filename, addr.module)</div><div>  File &quot;/usr/local/lib/python2.6/dist-packages/nose/importer.py&quot;, line 39, in importFromPath</div><div>    return self.importFromDir(dir_path, fqname)</div><div>  File &quot;/usr/local/lib/python2.6/dist-packages/nose/importer.py&quot;, line 86, in importFromDir</div>
<div>    mod = load_module(part_fqname, fh, filename, desc)</div><div>  File &quot;/home/alfredo/pacha/tests/test_permissions.py&quot;, line 10, in &lt;module&gt;</div><div>    from lib import hg, permissions, database</div>
<div>ImportError: cannot import name permissions</div><div><br></div></div></div><div><br></div><div><br></div><div>Maybe I need to import differently? But then again... *why* it works when I call it directly? I basically want </div>
<div>to be able to run from either /project or /project/tests with the same results.</div><div><br></div><div><br clear="all"><br>-- <br>Alfredo Deza<br><br>
</div>