1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
Author: Dmitry Shachnev <mitya57@gmail.com>
Description: make tests return non-zero value on failures, and increase verbosity
Forwarded: not-needed
Last-Update: 2013-05-24
--- a/tests/module_test_runner.py
+++ b/tests/module_test_runner.py
@@ -41,7 +41,7 @@
It also sets any module variables which match the settings keys to the
corresponding values in the settings member.
"""
- runner = unittest.TextTestRunner()
+ runner = unittest.TextTestRunner(verbosity=2)
for module in self.modules:
# Set any module variables according to the contents in the settings
for setting, value in self.settings.iteritems():
@@ -53,5 +53,6 @@
pass
# We have set all of the applicable settings for the module, now
# run the tests.
- print '\nRunning all tests in module', module.__name__
- runner.run(unittest.defaultTestLoader.loadTestsFromModule(module))
+ result = runner.run(unittest.defaultTestLoader.loadTestsFromModule(module))
+ if not result.wasSuccessful():
+ raise Exception('Tests failed!')
|