从django-social-auth导入测试时出现Python导入错误

时间:2013-01-21 20:54:04

标签: python testing import django-socialauth

我试图从django-social-auth包中继承一些类来创建自定义测试。

来源https://github.com/omab/django-social-auth

问题是我无法导入"测试"部分:

C:\Users\Alle>python
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import social_auth.tests.base
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named tests.base
>>> import social_auth.tests
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named tests
>>> import social_auth.db
>>> social_auth.db
<module 'social_auth.db' from 'C:\Python26\lib\site-packages\social_auth\db\__init__.pyc'>
>>>

为什么我会出现这种行为?

1 个答案:

答案 0 :(得分:1)

默认情况下未安装测试

来自social_auth setup.py

  packages=['social_auth',
            'social_auth.management',
            'social_auth.management.commands',
            'social_auth.backends',
            'social_auth.backends.contrib',
            'social_auth.backends.pipeline',
            'social_auth.migrations',
            'social_auth.db'],