title: Using code in init.py when running python from command line
body: <p>I'm setting up some code for unittesting. My directory currently looks like this:</p>
  
  <pre><code>project/
      src/
          __init__.py
          sources.py
      test/
          __init__.py
          sources_test.py
  </code></pre>
  
  <p>In __init__.py for the test directory, I have these two lines:</p>
  
  <pre><code>import sys
  sys.path.insert(0, '../')
  </code></pre>
  
  <p>In the test files, I have the line <code>import src.sources</code>.</p>
  
  <p>When I use <a href="https://nose.readthedocs.org/en/latest/" rel="nofollow">nose</a> to run these tests from the project directory, everything works just fine. If I try to run the tests individually it gives me this error:</p>
  
  <pre><code>ImportError: No module named src.sources
  </code></pre>
  
  <p>I assume that this is because when I run the test from the command line it isn't using __init__.py. Is there a way I can make sure that it will use those lines even when I try to run the tests individually?</p>
  
  <p>I could take the lines out of __init__.py and put them into my test files, but I'm trying to avoid doing that.</p>
  
  <p>To run the tests individually I am running <code>python sources_test.py</code></p>