Created
June 5, 2012 08:08
-
-
Save bulkan/2873524 to your computer and use it in GitHub Desktop.
capture unittest output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import unittest | |
import StringIO | |
class DumbestTest(unittest.TestCase): | |
def test_dumber(self): | |
self.assertEqual(True, True) | |
if __name__ == '__main__': | |
result_stream = StringIO.StringIO() | |
runner = unittest.TextTestRunner(stream=result_stream, verbosity=2) | |
my_suite = unittest.TestSuite() | |
my_suite.addTest(DumbestTest('test_dumber')) | |
result = runner.run(my_suite) | |
print int(result.wasSuccessful()) | |
sys.exit(int(result.wasSuccessful())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment