Skip to content

Instantly share code, notes, and snippets.

@lincolndbryant
Created October 5, 2012 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lincolndbryant/3841214 to your computer and use it in GitHub Desktop.
Save lincolndbryant/3841214 to your computer and use it in GitHub Desktop.
TestCase that does not catch exceptions so you can debug them interactively
import unittest
"""
When you user code or assertions throw exceptions, default behavior is to aggregate and report these, calls to each test method are wrapped in try:. When it is preferrable to handle these with a debugger and step back into frames of user code, this subclass this TestCase which uses .debug() rather then .run()
"""
class DebuggableTestCase(unittest.TestCase):
def __call__(self, *args, **kwargs):
return self.debug()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment