title: python unittest failing with relative import in source code
body: <p>I have my python source code and unittest code structure in the following hierarchy:</p>
  
  <pre><code>bin/
      module1.py
      module2.py
      module3.py
  test/
      module1_test.py
  </code></pre>
  
  <p>The code in the modules are as follows:
  module1.py</p>
  
  <pre><code>from module2 import testMethod1, testMethod2
  def testMethodY():
      ...
      ...
      ...
  </code></pre>
  
  <p>module2.py</p>
  
  <pre><code>from module3 import testMethod4
  </code></pre>
  
  <p>module3.py</p>
  
  <pre><code>def testMethod4():
  </code></pre>
  
  <p>module1_test.py</p>
  
  <pre><code>import unittest
  import sys, os
  path = os.path.dirname(__file__)
  path = os.path.join(path, 'bin')
  sys.path.append("/bin")
  from module1 import testMethodY
  
  ...(Some code for unit test)
  </code></pre>
  
  <p>when I run python module1_test.py
  it fails with import error:</p>
  
  <pre><code>ImportError: cannot import name testMethod4
  </code></pre>
  
  <p>Not sure what is wrong. If I run the source code then all the imports are working fine. But with python unittest these relative imports are failing. Can anyone tell me what mistake i'm doing.</p>