Kaydet (Commit) 202dd1ef authored tarafından Guido van Rossum's avatar Guido van Rossum

In unconditional except clauses, don't catch KeyboardInterrupt -- it's

annoying that often you have to hit ^C numerous times before it
works.  The solution: before the "except:" clause, insert "except
KeyboardInterrupt: raise".  This propagates KeyboardInterrupt out,
stopping the test in its tracks.
üst eb4b7bad
...@@ -202,6 +202,8 @@ class TestCase: ...@@ -202,6 +202,8 @@ class TestCase:
try: try:
try: try:
self.setUp() self.setUp()
except KeyboardInterrupt:
raise
except: except:
result.addError(self, self.__exc_info()) result.addError(self, self.__exc_info())
return return
...@@ -212,11 +214,15 @@ class TestCase: ...@@ -212,11 +214,15 @@ class TestCase:
ok = 1 ok = 1
except self.failureException, e: except self.failureException, e:
result.addFailure(self, self.__exc_info()) result.addFailure(self, self.__exc_info())
except KeyboardInterrupt:
raise
except: except:
result.addError(self, self.__exc_info()) result.addError(self, self.__exc_info())
try: try:
self.tearDown() self.tearDown()
except KeyboardInterrupt:
raise
except: except:
result.addError(self, self.__exc_info()) result.addError(self, self.__exc_info())
ok = 0 ok = 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment