Project tree:
|___sb_website
| |___article
| | |__...py
| |___home
| | |__...py
| |___sb_website
| | |__dev_settings.py
| | |__...py
| |__manage.py
| |__...py
My django project development settings are dev_settings.py
. I want to run my tests against these settings.
When I use a Python configuration in PyCharm with these parameters test --settings=sb_website.dev_settings
, script path ..\sb_website\manage.py
I get the following Error:
ERROR: sb_website.article (unittest.loader._FailedTest) ImportError: Failed to import test module: sb_website.article
.
Same for sb_website.home
and sb_website.sb_website
If use a Django Test configuration in PyCharm modules are imported and tests run fine.
I'd like to learn the root cause of my problem as it is not the first time I faced this.
What I tried:
changed all imports to explicit imports, e.g. *.models
to home.models