Python 为什么可以';我不能用pdb交互式调试器中断正在运行的测试吗?
如何使用pdb交互式调试器进入正在运行的测试 这就是测试:Python 为什么可以';我不能用pdb交互式调试器中断正在运行的测试吗?,python,django,testing,pdb,Python,Django,Testing,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'john@beatles.com'], u'bnewaccount': [u
class UserTestCase(TestCase):
def test_register_should_create_UserProfile(self):
c = Client()
response = c.post('/account/register/', {u'username': [u'john'], u'email': [u'john@beatles.com'], 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())
当我尝试运行测试时:$python manage.py测试 将创建测试数据库。当测试通过时,进度点“.”开始在屏幕上进行。 然后进程停止 终端窗口中从未显示pdb>提示
如何使pdb正常工作?您是否尝试过ipdb而不是香草pdb?我使用ipdb,您尝试做的工作很好
或者,作为一种回退,为什么不在返回响应之前,在正在测试的方法中尝试pdb调用呢 你试过ipdb而不是香草pdb吗?我使用ipdb,您尝试做的工作很好
或者,作为一种回退,为什么不在返回响应之前,在正在测试的方法中尝试pdb调用呢 在示例用法中,ipdb和pdb之间应该没有差异。它们应该都能正常工作。我会首先将导入移动到测试的第一行,而不是切换工具。切换工具可能掩盖了一个不同的问题。在示例使用中,ipdb和pdb之间应该没有差异。它们应该都能正常工作。我会首先将导入移动到测试的第一行,而不是切换工具。切换工具可能会掩盖另一个问题。