PyCharm & Paths question

On OSX 10.6.8, latest PyCharm.

I have a project set up in PyCharm, with folder/module containing tests, which I run with pytest.

- project-dir
     - tests-dir

I can run the test files correctly from within PyCharm, including "import" of files from the project-dir one level above.

However, when I open a terminal (to run tests with a performance profiler), cd to the tests-dir, and run python, I cannot load the tests files as the imports from project-dir fail.

Is PyCharm doing something special here? Do I need to do some paths-stuff?

I'm not sure if this is a PyCharm question or a Python question, thanks for any pointers!

1 comment
Comment actions Permalink
PyCharm automatically adds the root directory of your project (project-dir) to PYTHONPATH automatically. The easiest way to achieve this behavior when using the command line is to run the tests when the current directory is project-dir, not tests-dir.

Please sign in to leave a comment.