title: Python Nose Import Error
body: <p>I can't seem to get the <a href="https://nose.readthedocs.org/en/latest/" rel="noreferrer">nose testing framework</a> to recognize modules beneath my test script in the file structure.  I've set up the simplest example that demonstrates the problem. I'll explain it below.</p>
  
  <p>Here's the the package file structure:</p>
  
  <pre><code>./__init__.py
  ./foo.py
  ./tests
     ./__init__.py
     ./test_foo.py
  </code></pre>
  
  <p>foo.py contains:</p>
  
  <pre><code>def dumb_true():
      return True
  </code></pre>
  
  <p>tests/test_foo.py contains:</p>
  
  <pre><code>import foo
  
  def test_foo():
      assert foo.dumb_true()
  </code></pre>
  
  <p>Both <strong>init</strong>.py files are empty</p>
  
  <p>If I run <code>nosetests -vv</code> in the main directory (where foo.py is), I get:</p>
  
  <pre><code>Failure: ImportError (No module named foo) ... ERROR
  
  ======================================================================
  ERROR: Failure: ImportError (No module named foo)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/usr/lib/python/site-packages/nose-0.11.1-py2.6.egg/nose/loader.py", line 379, in loadTestsFromName
      addr.filename, addr.module)
    File "/usr/lib/python/site-packages/nose-0.11.1-py2.6.egg/nose/importer.py", line 39, in importFromPath
      return self.importFromDir(dir_path, fqname)
    File "/usr/lib/python/site-packages/nose-0.11.1-py2.6.egg/nose/importer.py", line 86, in importFromDir
      mod = load_module(part_fqname, fh, filename, desc)
    File "/home/user/nose_testing/tests/test_foo.py", line 1, in &lt;module&gt;
      import foo
  ImportError: No module named foo
  
  ----------------------------------------------------------------------
  Ran 1 test in 0.002s
  
  FAILED (errors=1)
  </code></pre>
  
  <p>I get the same error when I run from inside the tests/ directory.  According to the documentation and <a href="http://schettino72.wordpress.com/2008/01/19/11/" rel="noreferrer">an example</a> I found, nose is supposed to add all parent packages to the path as well as the directory from which it is called, but this doesn't seem to be happening in my case.  </p>
  
  <p>I'm running Ubuntu 8.04 with Python 2.6.2.  I've built and installed nose manually (not with setup_tools) if that matters. </p>