A tenet of unit-testing is that each test should be independent of all others.
If in your case the code in testTestA must come before testTestB, then you could
combine both into one test:
def testTestA_and_TestB(self):
# test code from testTestA
...
# test code from testTestB
or, perhaps better would be
def TestA(self):
# test code
def TestB(self):
# test code
def test_A_then_B(self):
self.TestA()
self.TestB()
The Test
class only tests those methods who name begins with a lower-case test...
.
So you can put in extra helper methods TestA
and TestB
which won’t get run unless you explicitly call them.