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 'nosetests -v' in /project everything runs OK (tests import from within 'lib'). </div><div><br></div><div>But when I am within /project/tests 'nosetests -v' 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>'nosetests -v test_permissions.py'</div><div><br></div><div>It also works fine when calling it via python:</div><div><br></div><div>'python test_permissions.py'</div><div><br></div><div>The one file that test_permissions.py is trying to import but is failing is: 'permissions', and it does so by:</div>
<div><br></div><div>sys.path.append('../')</div><div>from lib import hg, permissions, upgrade</div><div><br></div><div>I am not sure why it would be able to import 'hg' and 'database', but fail to import 'permissions', 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 "/usr/local/lib/python2.6/dist-packages/nose/loader.py", line 382, in loadTestsFromName</div>
<div> addr.filename, addr.module)</div><div> File "/usr/local/lib/python2.6/dist-packages/nose/importer.py", line 39, in importFromPath</div><div> return self.importFromDir(dir_path, fqname)</div><div> File "/usr/local/lib/python2.6/dist-packages/nose/importer.py", line 86, in importFromDir</div>
<div> mod = load_module(part_fqname, fh, filename, desc)</div><div> File "/home/alfredo/pacha/tests/test_permissions.py", line 10, in <module></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>