On Tue, Apr 19, 2011 at 3:44 PM, Thomas Weholt <[email protected]>wrote:

> I'm wondering if anybody has a hint on how to debug a unittest, or any
> other piece of code in django, for that matter, using a debugger like
> winpdb?
> I'm trying to to a winpdb manage.py test photo, which runs my unittest
> for my photo app, but winpdb crashes. Are there alternatives? What is
> the best way to do this?


 I don't know about winpdb, but if it's compatible with pdb, then I just do
this:

class ExampleTestCase(TestCase):
    def test_something(self):
        # some test code
        # ...
        import pdb; pdb.set_trace()
        # ...
        # rest of the test code

Then run your tests normally, and the debugger will automatically be invoked
at the 'pdb.set_trace()' line.

To speed things up, you can run
./manage.py test app.ExampleTestCase.test_something

And only the one test that you specify will actually be run.

-- 
Regards,
Ian Clelland
<[email protected]>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to