I usually group my tests into classes using unittest.
one test_TheClass.py file for each module.class
one Test_TheClass_the_method(unittest) class for each module.class.method.
lots of methods in the test class named test_*
This is nice organizationally and unittest offers some functionality that you don't get by just using assert.
It did increase the line count on the tests by a lot. Some of these test methods might be overkill when organized this way. I usually write tests that test for one thing only, but the existing tests check for a lot of little things. That isn't a bad thing, I am wondering how to find a middle ground between the two approaches.
I usually group my tests into classes using
unittest
.test_TheClass.py
file for eachmodule.class
Test_TheClass_the_method(unittest)
class for eachmodule.class.method
.test_*
This is nice organizationally and
unittest
offers some functionality that you don't get by just usingassert
.It did increase the line count on the tests by a lot. Some of these test methods might be overkill when organized this way. I usually write tests that test for one thing only, but the existing tests check for a lot of little things. That isn't a bad thing, I am wondering how to find a middle ground between the two approaches.