I have a problem with python directories.
I have structure like:
- python
- modules
- algorithms
- cyphers
- morse.py
- cyphers
- algorithms
- tests
- algorithms
- cyphers
- test_morse.py
- cyphers
- algorithms
- modules
When I try to import module in test I get a module not found error. I am trying to import like:
parent_dir_name = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(parent_dir_name + "/../../../")
from modules.algorithms.cyphers.morse import *
I have also init files in all directories. I am trying to run tests like:
> python -m unittest discover ./tests