Exit with error code if Python tests fail
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/6a5fed41 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/6a5fed41 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/6a5fed41 Branch: refs/heads/master Commit: 6a5fed41fcea5802242765cdc8084fa4b3453553 Parents: 335d918 Author: Nick Wellnhofer <[email protected]> Authored: Fri Aug 26 19:02:38 2016 +0200 Committer: Nick Wellnhofer <[email protected]> Committed: Fri Aug 26 19:19:32 2016 +0200 ---------------------------------------------------------------------- compiler/python/setup.py | 3 ++- runtime/python/setup.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/6a5fed41/compiler/python/setup.py ---------------------------------------------------------------------- diff --git a/compiler/python/setup.py b/compiler/python/setup.py index 7f64c1a..28b0401 100644 --- a/compiler/python/setup.py +++ b/compiler/python/setup.py @@ -162,7 +162,8 @@ class test(_Command): loader = unittest.TestLoader() tests = loader.discover("test") test_runner = unittest.runner.TextTestRunner() - test_runner.run(tests) + if not test_runner.run(tests).wasSuccessful(): + sys.exit(1) # restore sys.path sys.path = orig_sys_path http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/6a5fed41/runtime/python/setup.py ---------------------------------------------------------------------- diff --git a/runtime/python/setup.py b/runtime/python/setup.py index 26380df..17eb7f0 100644 --- a/runtime/python/setup.py +++ b/runtime/python/setup.py @@ -199,7 +199,8 @@ class test(_Command): loader = unittest.TestLoader() tests = loader.discover("test") test_runner = unittest.runner.TextTestRunner() - test_runner.run(tests) + if not test_runner.run(tests).wasSuccessful(): + sys.exit(1) # restore sys.path sys.path = orig_sys_path
