我学习测试驱动开发...为什么我的测试没有在我的TestCase子类中运行?
我写了一个测试失败了,但它不是...
(env)glitch:ipals nathann$ ./manage.py test npage/
Creating test database for alias 'default'...
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
Destroying test database for alias 'default'...
在NPAGE
/我有tests.py:
from django.test import TestCase
from npage.models import Tip
import datetime
# Example
class TipTester(TestCase):
def setUp(self):
print dir(self)
Tip.objects.create(pk=1,
text='Testing',
es_text='Probando')
def tips_in_spanish(self):
my_tip = Tip.objects.get(pk=1)
my_tip.set_language('es')
self.assertEqual(my_tip.text, 'this does not just say \'Probando\'')
我在做什么错?我读过this,但我仍然无法弄清楚这里出了什么问题。
我不认为你需要在你运行的命令npage后的正斜杠。 –
显然你可以做很多不同的方法,甚至隔离应用程序本身的测试用例:https://docs.djangoproject.com/en/dev/topics/testing/overview/#running-tests – broinjc
嗯,我刚刚学会了一些新的东西 –