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