From 5235c3e37e17b3271e3cac4646eaf97fd1cc071a Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Fri, 26 Aug 2011 12:09:55 +0100 Subject: [PATCH] Make BetterLoader() have a better api :) --- flask/testsuite/__init__.py | 3 +-- run-tests.py | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/flask/testsuite/__init__.py b/flask/testsuite/__init__.py index 5ebc786e..addbb92b 100644 --- a/flask/testsuite/__init__.py +++ b/flask/testsuite/__init__.py @@ -157,8 +157,7 @@ class BetterLoader(unittest.TestLoader): all_tests.append(testcase) if not all_tests: - print >> sys.stderr, 'Error: could not find test case for "%s"' % name - sys.exit(1) + raise LookupError('could not find test case for "%s"' % name) if len(all_tests) == 1: return all_tests[0] diff --git a/run-tests.py b/run-tests.py index 7d44febc..0c8d0bdf 100644 --- a/run-tests.py +++ b/run-tests.py @@ -1,3 +1,6 @@ import unittest from flask.testsuite import BetterLoader -unittest.main(testLoader=BetterLoader(), defaultTest='suite') +try: + unittest.main(testLoader=BetterLoader(), defaultTest='suite') +except Exception, e: + print 'Error: %s' % e