How to run testuite using unittest.main

Possible duplicate:
Python unittest - call unittest.main () using custom TestSuite

I have testuite created for example

suite = unittest.TestSuite()
suite.addTest(module1.MyTest("test_simple"))
suite.addTest(module2.MyTest("test_simple"))

and start these tests with unitest.main(). When you try, just the unitest.main(suite)tests do not run at all. How can I do this with unittest.main()no call test.TextTestRunneror similar?

+1
source share
1 answer

You cannot pass TestSuiteto main, check the constructor unittest.main.TestProgram(which was unittest.mainactually is) and how this class works. The first argument, if something is the name of the module, not testuite.

main() sys.argv, , . .

+3

All Articles