##// END OF EJS Templates
tests: lexicographical imports in silenttestrunner.py
Robert Stanca -
r28736:403b0a7a default
parent child Browse files
Show More
@@ -1,24 +1,24 b''
1 from __future__ import absolute_import, print_function
1 from __future__ import absolute_import, print_function
2 import os
3 import sys
2 import unittest
4 import unittest
3 import sys
4 import os
5
5
6 def main(modulename):
6 def main(modulename):
7 '''run the tests found in module, printing nothing when all tests pass'''
7 '''run the tests found in module, printing nothing when all tests pass'''
8 module = sys.modules[modulename]
8 module = sys.modules[modulename]
9 suite = unittest.defaultTestLoader.loadTestsFromModule(module)
9 suite = unittest.defaultTestLoader.loadTestsFromModule(module)
10 results = unittest.TestResult()
10 results = unittest.TestResult()
11 suite.run(results)
11 suite.run(results)
12 if results.errors or results.failures:
12 if results.errors or results.failures:
13 for tc, exc in results.errors:
13 for tc, exc in results.errors:
14 print('ERROR:', tc)
14 print('ERROR:', tc)
15 print()
15 print()
16 sys.stdout.write(exc)
16 sys.stdout.write(exc)
17 for tc, exc in results.failures:
17 for tc, exc in results.failures:
18 print('FAIL:', tc)
18 print('FAIL:', tc)
19 print()
19 print()
20 sys.stdout.write(exc)
20 sys.stdout.write(exc)
21 sys.exit(1)
21 sys.exit(1)
22
22
23 if os.environ.get('SILENT_BE_NOISY'):
23 if os.environ.get('SILENT_BE_NOISY'):
24 main = unittest.main
24 main = unittest.main
General Comments 0
You need to be logged in to leave comments. Login now