0
如何使用pdb交互式调试器分解运行测试?为什么我不能用pdb交互式调试器分解运行测试?
这是测试:
class UserTestCase(TestCase):
def test_register_should_create_UserProfile(self):
c = Client()
response = c.post('/account/register/', {u'username': [u'john'], u'email': [u'[email protected]'], u'bnewaccount': [u'Signup']})
self.assertEqual(response.status_code, 302)
import pdb; pdb.set_trace()
user = User.objects.get(username ='john')
self.assertTrue(user.get_profile())
当我尝试运行测试:
$蟒蛇manage.py测试
创建测试数据库。进度点'。'当测试通过时,开始在屏幕上前进。 然后这个过程停止。
我从来没有在终端窗口中显示pdb>提示符。
我该如何让pdb正常工作?
iPdb确实有效。我将使用它作为我的默认调试器。 – BryanWheelock 2010-02-24 14:40:25
在示例用法中,ipdb和pdb之间应该没有差别。他们都应该工作得很好。我会开始将导入移动到测试的第一行,而不是通过切换工具。切换工具可能掩盖了另一个问题。 – istruble 2010-02-24 18:28:10