开发者

How does 'manage.py test' work? (pdb problem)

I develop my django app on a mac with the dev server. When I run manage.py test I am able to break execution with pdb (as I can also when just running the site).

When I push the app to my linux production server (Ubuntu) running apache2/nginx pdb it no longer works on the site. It throws a BdbQuit Exception. I figured it would work when I ran manage.py test, but was surprised to find that the test just skipped over the pdb.set_trace() calls without stopping for them.

This seems to imply that manage.py test is running over the webserver, but that seems counter-intuitive, as my test code is pure python without any HTTP.

If manage开发者_开发问答.py test is hooking into the webserver is there a way for me to tell it to use the dev server?

I've tried installing ipdb, btw, and it does the same thing.


You've somehow diagnosed the problem wrongly. It simply doesn't make sense to say 'manage.py test is running over the webserver'. Your Django installation doesn't even know there's a webserver present, unless it's actually called by that webserver via WSGI - which obviously isn't the case when you're running tests via manage.py.

Are you sure your tests are being run correctly at all? Try putting a self.assertTrue(False) into the tests that have the call to pdb, to see if they fail as you expect - try it with the assertion alternately before and after the pdb and see what happens.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜