0
在Django的1.8,我有一个应用程序使用此设置:测试在子目录
app
|- tests/
| |- test_ook.py
| |- __init__.py
|- models.py
|- __init__.py
...
当我运行python manage.py test -v 2 app
,我得到这个错误:
ImportError: 'tests' module incorrectly imported from '/home/.../site/app/tests'. Expected '/home/.../site/app'. Is this module globally installed?
这是为什么?
我该如何解决?
请检查'app'中是否有'tests.py'或'tests.pyc'文件,即与'tests'模块处于同一级别。 –