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):
I have implemented a plugin nosedep for Nose which adds support for test dependencies and test prioritization.
As mentioned in the other answers/comments this is often a bad idea, however there can be exceptions where you would want to do this (in my case it was performance for integration tests - with a huge overhead for getting into a testable state, minutes vs hours).
A minimal example is:
def test_a:
pass
@depends(before=test_a)
def test_b:
pass
To ensure that test_b is always run before test_a.