How to debug Django unittests with PyDev? [duplicate]

◇◆丶佛笑我妖孽 提交于 2019-12-08 08:32:26

问题


i've written a few unittests for a Django project. I'd like to debug them. I've set a break point on the server side. what should I click to run the Django unittest with debugging enabled in PyDev Eclipse?

It seems I can run the manage.py test command from Pydev, but then there's no debugging. If I run the unittest with right-click debug unittest, then I get all sort Internal Server errors presumably because the test envrionment wasnt set up correctly.


回答1:


Setup a new debug configuration.

  • Run -> Debug Configurations...
  • Select 'PyDev Django'
  • Click 'New Launch Configuration (top left corner)
  • Name your new configuration
  • Set the project to your project
  • Set the module to your manage.py (browse to your manage.py)
  • Go to the 'Arguments' tab and enter 'test' under 'Program arguments'
  • Click 'Apply'

This will allow you to run 'manage.py test' and be able to stop on your breakpoints.

Unfortunately, you'll have to create different configurations if you only want to run a subset of tests.



来源:https://stackoverflow.com/questions/18424495/how-to-debug-django-unittests-with-pydev

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!