I have the following project structure and I am working with remote deployment with Pycharm.
source/
+- src/
+- __init__.py
+- abcd.py
+- test/
+- __init__.py
+- tests.py
In tests.py, I import src.abcd.
Running unittest in terminal with python -m unittest test.tests
in the source
folder is OK. But when I run the unittest in Pycharm, it says No module named 'src.abcd'
.
If I remove the __init__.py
in source/test
folder, Pycharm is OK but terminal reports error No module named 'test/tests'
.
Is there anyway to run unittest with both the commandline and Pycharm?