Commit 330c2854 authored by Guido van Rossum's avatar Guido van Rossum

Exclude KeyboardInterrupt from unqualified except: clauses.

parent 49523202
...@@ -58,6 +58,8 @@ class TestRunner: ...@@ -58,6 +58,8 @@ class TestRunner:
sys.path.append(path) # let module find things in its dir sys.path.append(path) # let module find things in its dir
try: try:
module=imp.load_module(name, file, pathname, desc) module=imp.load_module(name, file, pathname, desc)
except KeyboardInterrupt:
raise
except: except:
(tb_t, tb_v, tb_tb) = sys.exc_info() (tb_t, tb_v, tb_tb) = sys.exc_info()
self.report("Module %s failed to load\n%s: %s" % (pathname, self.report("Module %s failed to load\n%s: %s" % (pathname,
...@@ -146,6 +148,8 @@ class TestRunner: ...@@ -146,6 +148,8 @@ class TestRunner:
os.chdir(dirname) os.chdir(dirname)
try: try:
suite = self.getSuiteFromFile(name) suite = self.getSuiteFromFile(name)
except KeyboardInterrupt:
raise
except: except:
self.report('No test suite found in file:\n%s\n' % pathname) self.report('No test suite found in file:\n%s\n' % pathname)
if self.verbosity > 1: if self.verbosity > 1:
...@@ -186,7 +190,10 @@ class TestRunner: ...@@ -186,7 +190,10 @@ class TestRunner:
sys.stderr.write( '*** Changing directory to: %s\n' % dirname ) sys.stderr.write( '*** Changing directory to: %s\n' % dirname )
os.chdir(dirname) os.chdir(dirname)
self.report('Running: %s' % filename) self.report('Running: %s' % filename)
try: suite=self.getSuiteFromFile(name) try:
suite=self.getSuiteFromFile(name)
except KeyboardInterrupt:
raise
except: except:
traceback.print_exc() traceback.print_exc()
suite=None suite=None
......
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