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