Is there a way to make python unittest (I am using 2.6, I have unittest2 available) as soon as an error or fail occured without waiting all tests to finish?
And a bonus question :) Is there a way to order tests.开发者_StackOverflow中文版 For example, pulling tests that are likely to fail on front?
Run unittest
it with the -f
option.
Options:
-f, --failfast Stop on first failure
Example: ./auth_test.py -f
Where at the end of auth_test.py
you have
if __name__ == '__main__':
unittest.main()
For ordering - I don't think so. At least not out of the box. You can, however, run only a single test or class.
./auth_test.py MyTestClass # will run all tests in MyTestClass
./auth_test.py MyTestClass.test_my_work # will run only the test_my_work test
精彩评论