I have my source code inside the directory `medusa`, and my unit tests inside `tests` dir. Both dirs are inside `medusa-2.0` dir. Here is my file structure [1].
When I run my tests inside pycharm, everything works fine, but when I try to run my unit tests inside in the prompt [2], the `scheduler/predictionranking.py` can't find the `hdfs` import [3]. I have set my environment inside the `medusa-2.0` dir with the virtualenv, I even have set `medusa-2.0` in the PYTHON_PATH [4]. The error that I have is in [5]. The question is, why the import is not being done correctly? [1] My file structure medusa-2.0$ medusa (source code) hdfs.py scheduler (dir with my schedulers) predictionranking.py tests (my unit tests) [2] I run the unit test like this. medusa-2.0$ python -v tests/testSimpleRun.py [3] The header in `predictionranking.py` import hdfs def get_prediction_metrics(clusters, pinput): """ :param pinput (list) list of input paths """ input_size = hdfs.get_total_size(pinput) [4] My python path export MEDUSA_HOME=$HOME/repositories/git/medusa-2.0 export PYTHONPATH=${PYTHONPATH}:${MEDUSA_HOME}/medusa [5] error that I have medusa-2.0$ python -v tests/testSimpleRun.py # /home/xeon/repositories/git/medusa-2.0/medusa/local.pyc matches /home/xeon/repositories/git/medusa-2.0/medusa/local.py import medusa.local # precompiled from /home/xeon/repositories/git/medusa-2.0/medusa/local.pyc # /home/xeon/repositories/git/medusa-2.0/medusa/ranking.pyc matches /home/xeon/repositories/git/medusa-2.0/medusa/ranking.py import medusa.ranking # precompiled from /home/xeon/repositories/git/medusa-2.0/medusa/ranking.pyc # /home/xeon/repositories/git/medusa-2.0/medusa/decors.pyc matches /home/xeon/repositories/git/medusa-2.0/medusa/decors.py import medusa.decors # precompiled from /home/xeon/repositories/git/medusa-2.0/medusa/decors.pyc # /home/xeon/repositories/git/medusa-2.0/medusa/settings.pyc matches /home/xeon/repositories/git/medusa-2.0/medusa/settings.py import medusa.settings # precompiled from /home/xeon/repositories/git/medusa-2.0/medusa/settings.pyc import medusa.scheduler # directory /home/xeon/repositories/git/medusa-2.0/medusa/scheduler # /home/xeon/repositories/git/medusa-2.0/medusa/scheduler/__init__.pyc matches /home/xeon/repositories/git/medusa-2.0/medusa/scheduler/__init__.py import medusa.scheduler # precompiled from /home/xeon/repositories/git/medusa-2.0/medusa/scheduler/__init__.pyc # /home/xeon/repositories/git/medusa-2.0/medusa/scheduler/predictionranking.pyc matches /home/xeon/repositories/git/medusa-2.0/medusa/scheduler/predictionranking.py import medusa.scheduler.predictionranking # precompiled from /home/xeon/repositories/git/medusa-2.0/medusa/scheduler/predictionranking.pyc Traceback (most recent call last): File "tests/simpleRun.py", line 4, in <module> from medusa.simplealgorithm import run_simple_execution File "/home/xeon/repositories/git/medusa-2.0/medusa/simplealgorithm.py", line 8, in <module> import accidentalfaults File "/home/xeon/repositories/git/medusa-2.0/medusa/accidentalfaults.py", line 5, in <module> import hdfs File "/home/xeon/repositories/git/medusa-2.0/medusa/hdfs.py", line 6, in <module> from system import execute_command File "/home/xeon/repositories/git/medusa-2.0/medusa/system.py", line 10, in <module> from ranking import rank_clusters File "/home/xeon/repositories/git/medusa-2.0/medusa/ranking.py", line 9, in <module> from scheduler.predictionranking import get_prediction_metrics File "/home/xeon/repositories/git/medusa-2.0/medusa/scheduler/predictionranking.py", line 6, in <module> import hdfs -- https://mail.python.org/mailman/listinfo/python-list