Created
September 30, 2014 17:48
-
-
Save Matt3o12/4ae457ed07392ce753b8 to your computer and use it in GitHub Desktop.
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
Using `unittest.main()`: | |
python tests.py -b | |
.F | |
Stdout: | |
Should be printed since this test failed. | |
====================================================================== | |
FAIL: test_print (__main__.TestSequenceFunctions) | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): | |
File "tests.py", line 15, in test_print | |
self.fail() | |
AssertionError: None | |
Stdout: | |
Should be printed since this test failed. | |
---------------------------------------------------------------------- | |
Ran 2 tests in 0.000s | |
Using `unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports'))`: | |
Running tests... | |
---------------------------------------------------------------------- | |
Should not be printed. | |
Should be printed since this test failed. | |
.F | |
====================================================================== | |
FAIL [0.000s]: test_print (__main__.TestSequenceFunctions) | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): | |
File "tests.py", line 15, in test_print | |
self.fail() | |
AssertionError: None | |
---------------------------------------------------------------------- | |
Ran 2 tests in 0.001s | |
FAILED (failures=1) | |
Generating XML reports... |
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 random | |
import unittest | |
import xmlrunner | |
class TestSequenceFunctions(unittest.TestCase): | |
def setUp(self): | |
self.seq = list(range(10)) | |
def test_dont_print(self): | |
print("Should not be printed.") | |
def test_print(self): | |
print("Should be printed since this test failed.") | |
self.fail() | |
if __name__ == '__main__': | |
# unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports')) | |
unittest.main() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment