From 9f37eb817df5d9453e49edbcf2760832f333af68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 16 Dec 2016 15:32:16 +0100 Subject: Exit on test failure When test fails, it should not continue to run other commands. Fixes #891 --- setuptools/command/test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'setuptools/command') diff --git a/setuptools/command/test.py b/setuptools/command/test.py index 9a5117be..60ba2354 100644 --- a/setuptools/command/test.py +++ b/setuptools/command/test.py @@ -226,12 +226,14 @@ class test(Command): list(map(sys.modules.__delitem__, del_modules)) exit_kwarg = {} if sys.version_info < (2, 7) else {"exit": False} - unittest_main( + test = unittest_main( None, None, self._argv, testLoader=self._resolve_as_ep(self.test_loader), testRunner=self._resolve_as_ep(self.test_runner), **exit_kwarg ) + if not test.result.wasSuccessful(): + sys.exit(1) @property def _argv(self): -- cgit v1.2.1