Running python unittest in the console
Question: I have the follwoing package structure

    
    
    my-base-project
    -> package1
        __init__.py
        MyScript.py
    -> test
        __init__.py
        TestMyScript.py
    

I'd like to run the `TestMyScript.py` in the console. Therefore I cd in to
`my-base-project/test` and execute `python TestMyScript.py`. However, I'm
getting the error:

    
    
    user@computer:~/my-base-project/test$ python TestMyScript.py 
    Traceback (most recent call last):
      File "TestMyScript.py", line 4, in <module>
        from package1 import MyScript
    ImportError: No module named package1
    

How do I run these tests?


Answer: From [this SO question](http://stackoverflow.com/questions/4580101/python-add-
pythonpath-during-command-line-module-run), consider adding the directory you
need to the PYTHONPATH:

    
    
     import sys
     sys.path.append('your certain directory')
    

Maybe you want to add the parent directory

    
    
    sys.path.append('..')
    

