我希望不要通过重复询问这个问题来让自己变傻,但我无法弄清楚为什么我的灯具在运行测试时未加载。我使用python 2.7.5和Django 1.5.3。在测试Django时无法加载灯具
我可以加载我的灯具python manage.py testserver test_winning_answers
,位置survey/fixtures/test_winning_answers.json
。
Creating test database for alias 'default'...
Installed 13 object(s) from 1 fixture(s)
Validating models...
0 errors found
我的测试类是做正确的导入:
from django.test import TestCase
class QuestionWinningAnswersTest(TestCase):
fixtures = ['test_winning_answers.json']
...
但是,试图运行测试命令时,它无法找到他们:
python manage.py test survey.QuestionWinningAnswersTest -v3
...
Checking '/django/mysite/survey/fixtures' for fixtures...
...
No json fixture 'initial_data' in '/django/mysite/survey/fixtures'.
...
Installed 0 object(s) from 0 fixture(s)
...
我怀疑我失去了一些东西显而易见,但不能完全弄清楚...任何建议,将不胜感激。谢谢!
你也许尝试调试'TestCase的。 _fixture_setup'来看看什么装置被加载? – mariodev