How do I be sure of the unittest methods order? Is the alphabetical or numeric prefixes the proper way?
class TestFoo(TestCase):
def test_1(self):
Don't rely on the order. If they use some common state like the filesystem or database, then you should create setUp
and tearDown
methods that get your environment into a testable state, then clean up after the tests have run. Each test should assume that the environment is as defined in setUp
, and should make no further assumptions.