title: Import parent directory for brief tests
body: <p>I have searched this site top to bottom yet have not found a single way to actually accomplish what I want in Python3x. This is a simple toy app so I figured I could write some simple test cases in asserts and call it a day. It does generate reports and such so I would like to make sure my code doesn't do anything wonky upon changes.</p>
  
  <p>My current directory structure is: (only relevant parts included)</p>
  
  <pre><code>project
    -model
       __init__.py
       my_file.py
       -test
         my_file_test.py
  </code></pre>
  
  <p>I am having a hell of a time getting my_file_test.py to import my_file.py.</p>
  
  <p>Like I've said. I've searched this site top to bottom and no solution has worked. My version of Python is 3.2.3 running on Fedora 17. </p>
  
  <p>Previously tried attempts:
  <a href="https://stackoverflow.com/questions/4655526/how-to-accomplish-this-relative-import-in-python">https://stackoverflow.com/questions/5078590/dynamic-imports-relative-imports-in-python-3</a>
  <a href="https://stackoverflow.com/questions/714063/python-importing-modules-from-parent-folder">Importing modules from parent folder</a>
  <a href="https://stackoverflow.com/questions/1918539/can-anyone-explain-pythons-relative-imports">Can anyone explain python&#39;s relative imports?</a>
  <a href="https://stackoverflow.com/questions/4655526/how-to-accomplish-this-relative-import-in-python">How to accomplish relative import in python</a></p>
  
  <p>In virtually every attempt I get an error to the effect of: </p>
  
  <p>ImportError: No module named * 
  OR
  ValueError: Attempted relative import in non-package</p>
  
  <p>What is going on here. I have tried every accepted answer on SO as well as all over the interwebs. Not doing anything that fancy here but as a .NET/Java/Ruby programmer this is proving to be the absolute definition of intuitiveness. </p>
  
  <p>EDIT: If it matters I tried loading the class that I am trying to import in the REPL and I get the following: </p>
  
  <pre><code>&gt;&gt;&gt; import datafileclass
  &gt;&gt;&gt; datafileclass.methods
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  &gt;&gt;&gt; x = datafileclass('sample_data/sample_input.csv')
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  TypeError: 'module' object is not callable
  </code></pre>
  
  <p>If it matters...I know the functionality in the class works but I can't import it which in the now is causing an inability to test. In the future will certainly cause integration issues. (names changed to protect the innocent)
  getting within a couple of weeks of desired functionality for this iteration of the library...any help could be useful. Would have done it in Ruby but the client wants the Python as a learning experience,</p>