1

我正在尝试从 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'>
>>>

为什么我会得到这种行为?

4

1 回答 1

1

默认情况下不安装测试

来自social_authsetup.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'],
于 2013-01-21T21:00:49.003 回答