title: How do I import a module from a parent directory? (unittest purposes)
body: <p>I have just finished writing the core section of a project I am working on and I want to write test for it using unittest before I continue. I am aware that I should have done this before, but when I started I didn't know Python, so.. whatever..</p>
  
  <p>What I would like to achieve: I have a sub-package of the main package which contains all the modules I want to test inside it. I want to put a subsubpackage inside that called 'tests' or something which then contains all of my test cases, which I'd like to be able to aggregate into a test suite from outside the package so eventually I can run all the test for the entire project in one go.</p>
  
  <p>The structure is something like this:</p>
  
  <pre><code>/projectPackage
  /projectPackage/package
  /projectPackage/package/\__init__.py (empty)
  /projectPackage/package/someModule.py
  /projectPackage/package/... (more modules)
  /projectPackage/package/testing.py (runs all the tests in /tests/)
  /projectPackage/package/tests
  /projectPackage/package/tests/\__init__.py (empty)
  /projectPackage/package/tests/someModuleTests.py
  </code></pre>
  
  <p>Problem I am having:</p>
  
  <p>someModuleTests has to import someModule from the parent package so it can test its methods. This doesn't seem to work. I get various errors like:</p>
  
  <pre><code>Attempted relative import beyond toplevel package
  </code></pre>
  
  <p>Anyway, I expect it's just because I am a Python noob! I have my own ideas on how I am going to do it for this project, because of course each is different, but any general advice on the structuring of medium-large python projects is also appreciated.</p>