无法在 APITestCase 中进行 运行 测试
Can not run tests in APITestCase
项目结构
proj/
apps/
app1/
...
tests.py
...
proj/
tests.py
class UsersTestCase(APITestCase):
def setUp(self):
self.user = User.objects.get(id=3)
self.client = APIClient()
def test_users_list(self):
...
I 运行 python manage.py 测试 --settings=proj.settings.local 并查看 运行 0.000 秒内进行 0 次测试
为什么?
尝试添加模块作为测试参数
python manage.py test --settings=proj.settings.local apps.app1
如果仍然失败,请检查您的 INSTALLED_APPS
中是否有 'apps.app1'
项目结构
proj/
apps/
app1/
...
tests.py
...
proj/
tests.py
class UsersTestCase(APITestCase):
def setUp(self):
self.user = User.objects.get(id=3)
self.client = APIClient()
def test_users_list(self):
...
I 运行 python manage.py 测试 --settings=proj.settings.local 并查看 运行 0.000 秒内进行 0 次测试
为什么?
尝试添加模块作为测试参数
python manage.py test --settings=proj.settings.local apps.app1
如果仍然失败,请检查您的 INSTALLED_APPS
'apps.app1'