diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2016-12-16 10:23:24 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-12-16 10:23:24 -0500 |
| commit | 078f2fab606587053644782c6a6c84202838b0b4 (patch) | |
| tree | 8b56788f6de8bc606990c2a5a6bb7bb10210771d | |
| parent | 083929cf87fe74e21a1a37afcb300ae73652b136 (diff) | |
| parent | 2c4fd43277fc477d85b50e15c37b176136676270 (diff) | |
| download | external_python_setuptools-078f2fab606587053644782c6a6c84202838b0b4.tar.gz external_python_setuptools-078f2fab606587053644782c6a6c84202838b0b4.tar.bz2 external_python_setuptools-078f2fab606587053644782c6a6c84202838b0b4.zip | |
Merge pull request #892 from cedk/exit_on_test_failure
Exit on test failure
| -rw-r--r-- | setuptools/command/test.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/setuptools/command/test.py b/setuptools/command/test.py index 9a5117be..ef0af12f 100644 --- a/setuptools/command/test.py +++ b/setuptools/command/test.py @@ -3,7 +3,8 @@ import operator import sys import contextlib import itertools -from distutils.errors import DistutilsOptionError +from distutils.errors import DistutilsError, DistutilsOptionError +from distutils import log from unittest import TestLoader from setuptools.extern import six @@ -226,12 +227,16 @@ 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(): + msg = 'Test failed: %s' % test.result + self.announce(msg, log.ERROR) + raise DistutilsError(msg) @property def _argv(self): |
