How can I quickly disable a try statement in python for testing?
debugging, exception, python, testing
Solution
You could reraise the exception as the first line of your except block, which would behave just as it would without the try/except.
try:
print 'foo'
# A lot more code...
print 'bar'
except:
raise # was: pass
Problem
Say I have the following code: ``` try: print 'foo' # A lot more code... print 'bar' except: pass ``` How would I for testing purposes disable the try-statement temporary? You can't just comment the `try` and `except` lines out as the indention will still be off. Isn't there any easier way than this? ``` #try: print 'foo' # A lot more code... print 'bar' #except: # pass ```