0

In Django 1.8, I have an app with this setting:

app
 |- tests/
 |   |- test_ook.py
 |   |- __init__.py
 |- models.py
 |- __init__.py
 ...

When I run python manage.py test -v 2 app, I get this error:

ImportError: 'tests' module incorrectly imported from '/home/.../site/app/tests'. Expected '/home/.../site/app'. Is this module globally installed?

Why is this?

How can I fix it?

Sardathrion - against SE abuse
  • 17,269
  • 27
  • 101
  • 156
  • 1
    Please check if you have `tests.py` or a `tests.pyc` file in the `app` i.e. at the same level as `tests` module. – Rahul Gupta Aug 28 '15 at 08:57

1 Answers1

6

This error generally occurs if you have tests.py or a tests.pyc file present in the app i.e. at the same level as tests module.

Remove those files and it should work perfectly.

Rahul Gupta
  • 46,769
  • 10
  • 112
  • 126