No module named .. while running Django tests with PyCharm

964 views Asked by At

I have the following error when running Django's tests with PyCharm 4.5 ImportError: No module named date_utils.

Here is a short overview the project tree:

.
├── manage.py
├── settings.py
├── app1
│   ├── models.py
│   ├── __init__.py            #Empty
├── utils
│   ├── __init__.py            #Empty
│   ├── date_utils.py

In app1.models.py, I do from utils.date_utils import my_wonderful_function

I import both apps in my settings.py

INSTALLED_APPS = (
    'grappelli',
    '...',
    'djcelery',
    'utils',
    'app1',
)

Please note that it is working well when using manage.py test.

Can you please help understanding why this is happening with PyCharm but not with manage.py ? Thanks !

1

There are 1 answers

1
trnsnt On BEST ANSWER

Ok, I found the problem. Problem was that PyCharm also have module named utils, and so the import was not using my module, but the PyCharm's one.