Django / Python module testing: allow you to increase the number of exceptions
I am debugging a unit test error causing the exception to be thrown from the guts of some libraries; many exceptions. I am using ipdb
from the command line to debug it.
on startup ./manage.py test path.to.test
and an exception occurs, the test runner catches the exception, prints the stack trace and notes that the test failed or whatever. I understand why this is useful instead of allowing an exception.
In my case, I want it to go up, so I ipdb
catch it and land in a good position to move up / down frames and debug problems. I don't want wrapper tests to run in try
or place calls ipdb.set_trace()
where exceptions are thrown. It is a pain and it slows down debugging. Usually this is not a problem, but today it is.
Q: Can I stop the tester by catching the exception, so ipdb
it won't replace it instead?
I feel like there must be a way to do this, as it would be very helpful when debugging, but I missed it along the line somewhere.
(Ps, Python 2.7, Django 1.6 primer)
source to share
There is django-nose , django unittest runner
, which still supports django 1.6 and python 2.7.
There is an option --pdb
for the nose that:
Discard the debugger on crashes or errors
And you can run it like this:
nosetests --pdb
Since you want to work with ipdb
, there is this nasal plugin that allows nose
you to use ipdb
:
nosetests --ipdb
source to share