comparison tests/run-tests.py @ 2258:7e43d68f3900

catch KeyboardInterrupt in run-tests
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Thu, 11 May 2006 14:06:18 +0200
parents 546c76e5a3e6
children 6ed46bad9530
comparison
equal deleted inserted replaced
2257:8dafccbcede9 2258:7e43d68f3900
240 BINDIR = os.path.join(INST, "bin") 240 BINDIR = os.path.join(INST, "bin")
241 PYTHONDIR = os.path.join(INST, "lib", "python") 241 PYTHONDIR = os.path.join(INST, "lib", "python")
242 COVERAGE_FILE = os.path.join(TESTDIR, ".coverage") 242 COVERAGE_FILE = os.path.join(TESTDIR, ".coverage")
243 243
244 try: 244 try:
245 install_hg() 245 try:
246 246 install_hg()
247 tests = 0 247
248 failed = 0 248 tests = 0
249 249 failed = 0
250 if len(args) == 0: 250
251 args = os.listdir(".") 251 if len(args) == 0:
252 for test in args: 252 args = os.listdir(".")
253 if test.startswith("test-"): 253 for test in args:
254 if '~' in test or re.search(r'\.(out|err)$', test): 254 if test.startswith("test-"):
255 continue 255 if '~' in test or re.search(r'\.(out|err)$', test):
256 if not run_one(test): 256 continue
257 failed += 1 257 if not run_one(test):
258 tests += 1 258 failed += 1
259 259 tests += 1
260 print "\n# Ran %d tests, %d failed." % (tests, failed) 260
261 if coverage: 261 print "\n# Ran %d tests, %d failed." % (tests, failed)
262 output_coverage() 262 if coverage:
263 output_coverage()
264 except KeyboardInterrupt:
265 failed = True
266 print "\ninterrupted!"
263 finally: 267 finally:
264 cleanup_exit() 268 cleanup_exit()
265 269
266 if failed: 270 if failed:
267 sys.exit(1) 271 sys.exit(1)