由于无法导入django.test模块,因此单元测试不起作用。
>>> import django.test
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\django\test\__init__.py", line 5, in <mod
le>
from django.test.client import Client, RequestFactory
File "C:\Python27\lib\site-packages\django\test\client.py", line 21, in <modu
e>
from django.test import signals
ImportError: cannot import name signals
>>>
请有人帮我解决。我正在使用django 1.3版
答案 0 :(得分:0)
这里解释的解决方案: ImportError: cannot import name signals 为我工作。
他们在测试中添加了这些行:
from django.core import management;
import myapp.settings as settings;
management.setup_environ(settings)